Skip to content

Instantly share code, notes, and snippets.

@LauraKokkarinen
Created May 12, 2024 09:31
Show Gist options
  • Save LauraKokkarinen/d6992f4ccd499b6299fd25e9b1d8975a to your computer and use it in GitHub Desktop.
Save LauraKokkarinen/d6992f4ccd499b6299fd25e9b1d8975a to your computer and use it in GitHub Desktop.
export const msalConfig = {
auth: {
clientId: `${process.env.REACT_APP_UI_CLIENT_ID}`,
// Defaults to "https://login.microsoftonline.com/common"
authority: `https://login.microsoftonline.com/${process.env.REACT_APP_UI_TENANT_ID}`,
// You must register this URI on the Entra app registration
redirectUri: `${process.env.REACT_APP_UI_REDIRECT_URI}`,
// The page to navigate after logout
postLogoutRedirectUri: `${process.env.REACT_APP_UI_REDIRECT_URI}`,
// If "true", will navigate back to the original request location before processing the auth code response
navigateToLoginRequestUrl: false,
},
cache: {
// Configures cache location. "sessionStorage" is more secure, but "localStorage" gives you SSO between tabs.
cacheLocation: `${process.env.REACT_APP_UI_CACHE_LOCATION}`,
// Set this to "true" if you are having issues on IE11 or Edge
storeAuthStateInCookie: false,
}
};
// Scopes you add here will be prompted for user consent during sign-in
// By default, MSAL.js will add OIDC scopes (openid, profile, email) to any login request
export const loginRequest = {
scopes: []
};
// The endpoints and scopes when obtaining an access token for protected web APIs
export const apis = {
customApi: {
endpoint: `${process.env.REACT_APP_API_ENDPOINT_URI}`,
// api://client_id/access_as_user
scopes: [`${process.env.REACT_APP_API_SCOPE_URI}/access_as_user`],
},
graphApi: {
endpoint: "https://graph.microsoft.com/v1.0",
scopes: ["User.Read"],
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment