mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-05-15 09:47:30 +01:00
Fix MPAC redirect URL (#2456)
* Fix MPAC redirect URL * Address comment
This commit is contained in:
+9
-13
@@ -2,7 +2,12 @@ import * as msal from "@azure/msal-browser";
|
||||
import { useBoolean } from "@fluentui/react-hooks";
|
||||
import * as React from "react";
|
||||
import { ConfigContext } from "../ConfigContext";
|
||||
import { acquireTokenWithMsal, getMsalInstance } from "../Utils/AuthorizationUtils";
|
||||
import {
|
||||
acquireTokenWithMsal,
|
||||
getMsalInstance,
|
||||
getPostLogoutRedirectUrl,
|
||||
getRedirectBridgeUrl,
|
||||
} from "../Utils/AuthorizationUtils";
|
||||
|
||||
const cachedTenantId = localStorage.getItem("cachedTenantId");
|
||||
|
||||
@@ -59,10 +64,7 @@ export function useAADAuth(config?: ConfigContext): ReturnType {
|
||||
return;
|
||||
}
|
||||
// Use redirect bridge for MSAL v5 COOP handling
|
||||
const redirectBridgeUrl =
|
||||
process.env.NODE_ENV === "development"
|
||||
? "https://dataexplorer-dev.azurewebsites.net/redirectBridge.html"
|
||||
: `${window.location.origin}/redirectBridge.html`;
|
||||
const redirectBridgeUrl = getRedirectBridgeUrl();
|
||||
|
||||
try {
|
||||
const response = await msalInstance.loginPopup({
|
||||
@@ -87,10 +89,7 @@ export function useAADAuth(config?: ConfigContext): ReturnType {
|
||||
setLoggedOut();
|
||||
localStorage.removeItem("cachedTenantId");
|
||||
// Redirect back to the hosted explorer after logout
|
||||
const postLogoutRedirectUri =
|
||||
process.env.NODE_ENV === "development"
|
||||
? "https://dataexplorer-dev.azurewebsites.net/hostedExplorer.html"
|
||||
: `${window.location.origin}`;
|
||||
const postLogoutRedirectUri = getPostLogoutRedirectUrl();
|
||||
msalInstance.logoutRedirect({ postLogoutRedirectUri });
|
||||
}, [msalInstance]);
|
||||
|
||||
@@ -100,10 +99,7 @@ export function useAADAuth(config?: ConfigContext): ReturnType {
|
||||
return;
|
||||
}
|
||||
// Use redirect bridge for MSAL v5 COOP handling
|
||||
const redirectBridgeUrl =
|
||||
process.env.NODE_ENV === "development"
|
||||
? "https://dataexplorer-dev.azurewebsites.net/redirectBridge.html"
|
||||
: `${window.location.origin}/redirectBridge.html`;
|
||||
const redirectBridgeUrl = getRedirectBridgeUrl();
|
||||
try {
|
||||
const response = await msalInstance.loginPopup({
|
||||
redirectUri: redirectBridgeUrl,
|
||||
|
||||
Reference in New Issue
Block a user