I have deployed a Static Web App in Azure with the following configuration settings:
I have the following authConfig.ts:
import { Configuration } from "@azure/msal-browser";
// Config object to be passed to Msal on creation
export const msalConfig: Configuration = {
auth: {
clientId: `${process.env["REACT_APP_AAD_UI_APP_CLIENT_ID"]}`,
authority: `https://login.microsoftonline.com/${process.env["REACT_APP_AAD_APP_TENANT_ID"]}`,
redirectUri: "/",
postLogoutRedirectUri: "/"
}
};
// scopes
export const loginRequest = {
scopes: [`api://${process.env["REACT_APP_AAD_API_APP_CLIENT_ID"]}/user_impersonation`]
};
// endpoints
export const config = {
endpoint: `${process.env["REACT_APP_AAD_APP_SERVICE_BASE_URI"]}/api/v1/items`
};
On running this after deployment, I see this error:
Looks like it's not reading the tenantId from the config. Request URL should be
https://login.microsoftonline.com/tenant-id/v2.0/.well-known/openid-configuration
This is running fine after I add .env file with the values:
REACT_APP_AAD_UI_APP_CLIENT_ID= 'xxxx'
REACT_APP_AAD_API_APP_CLIENT_ID= 'yyyy'
REACT_APP_AAD_APP_TENANT_ID= 'abcd'
REACT_APP_AAD_APP_SERVICE_BASE_URI= 'https://xxx.api.azurewebsites.net'
What am I missing?