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:
Zachary Foster
2021-05-27 16:18:44 -04:00
committed by GitHub
parent 75d01f655f
commit e41b52e265
5 changed files with 46 additions and 30 deletions

View File

@@ -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;
}