I have a Blazor .Net5 WebAssembly that uses Auth0 OIDC authentication. I setup the authentication following these instructions: https://auth0.com/blog/securing-blazor-webassembly-apps/
Following those instructions I was able to develop my app locally and get it working with Auth0 authentication. However, when I deploy the app using Azure Static Web Apps the authentication is no longer functional. Looking in the developer tools of Chrome I can see that it successfully (302) calls my authorization endpoint:
https://login.mysite.com/authorize?clientid=*****... (302)
The next url is the callback to my site, which fails with a 404:
https://myapp.mysite.com/authentication/login-callback?code=***... (404)
I do have the following in my index.html:
<script src="_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js"></script>
Any idea of what I can do to fix this?
I added a routes.json file to wwwroot with the following to fix the issue.
{
"routes": [
{
"route": "/*",
"serve": "/index.html",
"statusCode": 200
}
]
}