mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-20 09:20:16 +00:00
Redo user endpoint dynamic token (#827)
* Redo user endpoint dynamic token * Fixes aad endpoint race condition, tenant switching, and account permissions * Export const msalInstance * Format * fix import * format * Redo getMsalInstance * format again * Check for doc endpoint
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import * as msal from "@azure/msal-browser";
|
||||
import { AuthType } from "../AuthType";
|
||||
import * as Constants from "../Common/Constants";
|
||||
import * as Logger from "../Common/Logger";
|
||||
@@ -40,3 +41,21 @@ export function decryptJWTToken(token: string) {
|
||||
|
||||
return JSON.parse(tokenPayload);
|
||||
}
|
||||
|
||||
export function getMsalInstance() {
|
||||
const config: msal.Configuration = {
|
||||
cache: {
|
||||
cacheLocation: "localStorage",
|
||||
},
|
||||
auth: {
|
||||
authority: "https://login.microsoftonline.com/common",
|
||||
clientId: "203f1145-856a-4232-83d4-a43568fba23d",
|
||||
},
|
||||
};
|
||||
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
config.auth.redirectUri = "https://dataexplorer-dev.azurewebsites.net";
|
||||
}
|
||||
const msalInstance = new msal.PublicClientApplication(config);
|
||||
return msalInstance;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user