I'm working on a project where I implemented Auth0 authentication, and I've been able to do it correctly.
Login, Token Request, Call to my C# API with that token. All go well from my dev environment.
I Upload my SQL Database, C# API and Blazor App to Azure. The database and backend are working well, but I'm facing a issue when requesting the Token from the Blazor App when hosted on Azure, that I cannot find a solution for at the moment.
Here the complete message
Access to fetch at 'https://dev-xxxxxxxx.us.auth0.com/oauth/token' from origin 'https://xxxxxxxx.azurewebsites.net' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
But when configure my Blazor App from Dev Environment to connect to my azure host API it work well, I mean the API return me the data requested.
I only get Access-Control-Allow-Origin error when I try to run my app when hosted on Azure.
I've added the https://xxxxxxxx.azurewebsites.net' to the Auth0 application config in these two config options:
- Allowed Web Origins
- Allowed Origins (CORS)
Is there something that I miss? Is there a bug in Auth0 related to .Net 6 / WASM?
Thanks Hugo
CodePudding user response:
Ok Git it ... For the record
I saw what went wrong in the Auth0 monitoring/Logs It appear that I add the Origin at the wrong Auth0 Application config. Feeling dumm.