Before filing this issue, please ensure you're using the latest CLI by running swa --version and comparing to the latest version on npm.
Are you accessing the CLI from the default port :4280 ?
Make sure you are accessing the URL printed in the console when running swa start!
ℹ️ NOTE: Make sure to enable debug logs when running any swa commands using --verbose=silly
Describe the bug
AAD sign-in either works locally or remotely, depending on the format of the openIdIssuer url in the staticwebapp.config.json, but never in both environments.
In staticwebapp.config.json
This works locally
{
"openIdIssuer": "https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0",
}
But when deployment, I get ERR_TOO_MANY_REDIRECTS in the browser.
This works when deployed
{
"openIdIssuer": "https://login.microsoftonline.com/<tenant-id>/v2.0",
}
But in local emulator, I get 404 - This login.microsoftonline.com page can't be found
To Reproduce
Steps to reproduce the behavior:
To reproduce this, you would have to set up an Azure tenant with an AAD app in it. Here is my full staticwebapp.config.json for reference
{
"platform": {
"apiRuntime": "node:20"
},
"auth": {
"identityProviders": {
"azureActiveDirectory": {
"registration": {
"openIdIssuer": "https://login.microsoftonline.com/***********************************/v2.0",
"clientIdSettingName": "AAD_CLIENT_ID",
"clientSecretSettingName": "AZURE_CLIENT_SECRET_APP_SETTING_NAME"
}
}
}
},
"routes": [
{
"route": "/*",
"allowedRoles": [
"authenticated"
]
}
],
"responseOverrides": {
"401": {
"statusCode": 302,
"redirect": "/.auth/login/aad"
}
}
}
Expected behavior
Clear guidance on whether to include oauth2 in the URL and a consistent behavior between local and deployed environments.
Screenshots
Desktop (please complete the following information):
- OS: Windows 11
- Edge: Version 134.0.3124.72 (Official build) (64-bit)
Additional context
The documentation site says we should not use oauth2 in the url, but I have consulted with a library maintainer who said the documentation site is outdated.
For Microsoft internal contact, please use alias chusun
Before filing this issue, please ensure you're using the latest CLI by running
swa --versionand comparing to the latest version on npm.Are you accessing the CLI from the default port
:4280?--port) and accessing the CLI from that port:4280ℹ️ NOTE: Make sure to enable debug logs when running any
swacommands using--verbose=sillyDescribe the bug
AAD sign-in either works locally or remotely, depending on the format of the
openIdIssuerurl in thestaticwebapp.config.json, but never in both environments.In
staticwebapp.config.jsonThis works locally
{ "openIdIssuer": "https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0", }But when deployment, I get ERR_TOO_MANY_REDIRECTS in the browser.
This works when deployed
{ "openIdIssuer": "https://login.microsoftonline.com/<tenant-id>/v2.0", }But in local emulator, I get 404 - This login.microsoftonline.com page can't be found
To Reproduce
Steps to reproduce the behavior:
To reproduce this, you would have to set up an Azure tenant with an AAD app in it. Here is my full
staticwebapp.config.jsonfor reference{ "platform": { "apiRuntime": "node:20" }, "auth": { "identityProviders": { "azureActiveDirectory": { "registration": { "openIdIssuer": "https://login.microsoftonline.com/***********************************/v2.0", "clientIdSettingName": "AAD_CLIENT_ID", "clientSecretSettingName": "AZURE_CLIENT_SECRET_APP_SETTING_NAME" } } } }, "routes": [ { "route": "/*", "allowedRoles": [ "authenticated" ] } ], "responseOverrides": { "401": { "statusCode": 302, "redirect": "/.auth/login/aad" } } }Expected behavior
Clear guidance on whether to include
oauth2in the URL and a consistent behavior between local and deployed environments.Screenshots
Desktop (please complete the following information):
Additional context
The documentation site says we should not use
oauth2in the url, but I have consulted with a library maintainer who said the documentation site is outdated.For Microsoft internal contact, please use alias chusun