I try to use Auth0 for my Blazor Server App(.net 6) hosted as Azure App Service.
Everything works fine until i add force email verification into my login flow:
exports.onExecutePostLogin = async (event, api) => {
if (!event.user.email_verified) {
api.access.deny(“Bitte verifiziere zunächst deine E-Mail.”);
}
};
My problem is i can not handle the access_denied error in /callback to show an error to the user, because i am getting a HTTP Error 500.0.
Can someone please lead me in the right direction what i need to do?
Here is the error discription:
HTTP Error 500.0 - Internal Server Error
The page cannot be displayed because an internal server error has occurred.
Most likely causes:
- IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.
- IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
- IIS was not able to process configuration for the Web site or application.
- The authenticated user does not have permission to use this DLL.
- The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.
Things you can try:
- Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server’s machine account.
- Check the event logs to see if any additional information was logged.
- Verify the permissions for the DLL.
- Install the .NET Extensibility feature if the request is mapped to a managed handler.
- Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here.
Detailed Error Information:
Module | AspNetCoreModuleV2 |
---|---|
Notification | ExecuteRequestHandler |
Handler | aspNetCore |
Error Code | 0x00000000 |
Requested URL | https://XXXXXAppService:80/callback |
---|---|
Physical Path | C:\home\site\wwwroot\callback |
Logon Method | Anonymous |
Logon User | Anonymous |
More Information:
This error means that there was a problem while processing the request. The request was received by the Web server, but during processing a fatal error occurred, causing the 500 error.
Microsoft Knowledge Base Articles:
2023-08-15 11:04:18.083 +00:00 [Error] Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler: Message contains error: ‘access_denied’, error_description: ‘Access Denied’, error_uri: ‘error_uri is null’. 2023-08-15 11:04:18.090 +00:00 [Error] Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer: Connection ID “18302628887244360979”, Request ID “8000cd20-0000-fe00-b63f-84710c7967bb”: An unhandled exception was thrown by the application.System.Exception: An error was encountered while handling the remote login.—> Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectProtocolException: Message contains error: ‘access_denied’, error_description: ‘Access Denied’, error_uri: ‘error_uri is null’.— End of inner exception stack trace —at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler1.HandleRequestAsync()at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT
1.ProcessRequestAsync()