Azure / static-web-apps

Azure Static Web Apps. For bugs and feature requests, please create an issue in this repo. For community discussions, latest updates, kindly refer to the Discussions Tab. To know what's new in Static Web Apps, visit https://aka.ms/swa/ThisMonth
https://aka.ms/swa
MIT License
323 stars 55 forks source link

500 error from Server on Auth Callback from B2C #479

Open datawatts opened 3 years ago

datawatts commented 3 years ago

Using Azure AD B2C as an auth provider, I receive a 500 error upon callback. There are no logs (I do not use Functions). How can you debug with no server logs? My staticwebapp.conig.json is below. The url response is of the form "../.auth/login/AzureB2C/callback?state=%2f.auth%2fcomplete&code=eyJraW....."

{ "auth": { "identityProviders": { "customOpenIdConnectProviders": { "AzureB2C": { "registration": { "clientIdSettingName": "<AAD_CLIENT_ID>", "clientCredential": { "clientSecretSettingName": "<AAD_CLIENT_SECRET>" }, "openIdConnectConfiguration": { "wellKnownOpenIdConfiguration": "https://<DOMAIN>.b2clogin.com/<DOMAIN>.onmicrosoft.com/v2.0/.well-known/openid-configuration?p=B2C_1_Default" } }, "login": { "nameClaimType": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name", "scopes": ["openid"], "loginParameterNames": [] } } } } }, "navigationFallback": { "rewrite": "index.html", "exclude": [ "/images/*.{png,jpg,gif}", "/css/*" ] }, "mimeTypes": { ".json": "text/json" }, "routes": [ { "route": "/login", "rewrite": "/.auth/login/AzureB2C" } ] }

mkarmark commented 3 years ago

We are working on surfacing these error logs to the customers but this will still take some time to set up. In the meantime, if you post your app name here, we can look up the logs on our end and let you know what went on.

datawatts commented 3 years ago

The app url is https://salmon-sand-037a58b10.azurestaticapps.net. I am using a custom domain if that makes a difference.

mkarmark commented 3 years ago

I see an error in our logs that does not refer to a valid app setting, and that makes sense because we don't allow app settings to have the < > characters. Do you intend to include those brackets in the setting name fields?

anthonychu commented 3 years ago

@craigshoemaker tbe <> around placeholders are still causing issues. I suggest we remove them from docs and recommend them as the setting names to use.

datawatts commented 3 years ago

I am not using the < > characters in the actual staticwebapp.config.json. I was just referring them as variables in what I shared. I did have an old version where I mistakenly left those in, but since have changed and am still seeing the above error as of this morning.

datawatts commented 3 years ago

@mkarmark Per my last comment, I have confirmed I am not using the < > characters and am still seeing the error as of this morning. Also, I am using a custom domain, would that be what you need to view logs?

nazimamin commented 3 years ago

Issue #547 also has a similar error. 500 error on Auth callback using Azure B2C