Azure B2C Custom Auth Provider doesn't seem to work
jezmaghuyop opened this issue · comments
Describe the bug
I'm trying to configure Custom Auth Provider with Azure Static Web Apps while on the "Standard" Pricing Plan. I'm using Azure B2C as the auth provider as we want to allow our users from our b2c account to be able to login to this static web apps.
- The index page is accessibile even though the allowedRoles is set to be "authenticated"
- typing "./auth/login/aadb2c" in the browser returns 404
below is my staticweapp.config.json file
{
"routes": [
{
"route": "/login",
"rewrite": "/.auth/login/aadb2c"
},
{
"route": "/logout",
"redirect": "/.auth/logout",
"allowedRoles": ["authenticated"]
},
{
"route": "/.auth/login/twitter",
"statusCode": 404
},
{
"route": "/.auth/login/google",
"statusCode": 404
},
{
"route": "/.auth/login/aad",
"statusCode": 404
},
{
"route": "/*",
"allowedRoles": ["authenticated"]
}
],
"responseOverrides": {
"401": {
"statusCode": 302,
"redirect": "/.auth/login/aadb2c"
}
},
"navigationFallback": {
"rewrite": "index.html",
"exclude": [
"/src2/docs/images/*.{png,jpg,gif,ico}",
"/src2/docs/img/*.{png,jpg,gif,ico}",
"/*.{css,scss,js}"
]
},
"auth": {
"rolesSource": "/api/Roles",
"identityProviders": {
"customOpenIdConnectProviders": {
"aadb2c": {
"registration": {
"clientIdSettingName": "AADB2C_PROVIDER_CLIENT_ID",
"clientCredential": {
"clientSecretSettingName": "AADB2C_PROVIDER_CLIENT_SECRET"
},
"openIdConnectConfiguration": {
"wellKnownOpenIdConfiguration": "https://<companyname>.b2clogin.com/<companyname>.onmicrosoft.com/B2C_1_SiIn/v2.0/.well-known/openid-configuration"
}
},
"login": {
"nameClaimType": "emails",
"scopes": [],
"loginParameterNames": []
},
"enabled": true
}
}
}
}
}
Expected behavior
-
I'm expecting for the page to automatically navigate to the "login" URL since I configured the wildcard route allowedRoles to be "authenticated" but users can still access the page even though they are not authenticated
Device info (if applicable):
- Browser: Edge
Additional context
Try to add "openid" to scopes:
"scopes": ["openid"],