Is there an existing issue for this?
Describe the bug
The following issue happens when logout
The info in the address bar
https://localhost:5001/authentication/logout-failed?message=The%20logout%20was%20not%20initiated%20from%20within%20the%20page.
The info in the page
There was an error trying to log you out:
The Blazor WebAssmbly is able to login and logout via the steps mentioned in the reproduce section.
However, the logout process will not trigger the logout callback function.
The more strange thing is if refresh the page after login, and then logout. The issue mentioned in the #31088 occurs but logout callback function is triggered. The solution in that issue doesn't help.
Expected Behavior
The callback function for OnLogOutSucceeded will always be called when logout succeeds.
Steps To Reproduce
-
Use the code in this repo as the base.
-
Then replace the Authentication.razor with the following code
@page "/authentication/{action}"
@using Microsoft.AspNetCore.Components.WebAssembly.Authentication
@using Microsoft.Extensions.Configuration
@inject NavigationManager Navigation
@inject IConfiguration Configuration
<RemoteAuthenticatorView Action="@Action" OnLogOutSucceeded="@logout">
<LogOut>
@{
var authority = (string)Configuration["Auth0:Authority"];
var clientId = (string)Configuration["Auth0:ClientId"];
Navigation.NavigateTo($"{authority}/v2/logout?client_id={clientId}");
}
</LogOut>
</RemoteAuthenticatorView>
@code{
[Parameter] public string Action { get; set; }
private void logout(RemoteAuthenticationState args)
{
Console.WriteLine("logout......");
}
}
- Finally replace the credentials in the
appsettings.json of client project
{
"Auth0": {
"Authority": "https://xxxx.auth0.com",
"ClientId": "xxxxGDzNm7xeMmPz"
}
}
dotnet run --project Server
Exceptions (if any)
No response
.NET Version
5.0.202
Anything else?
$ dotnet --info
.NET SDK (reflecting any global.json):
Version: 5.0.202
Commit: db7cc87d51
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19041
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.202\
Host (useful for support):
Version: 5.0.5
Commit: 2f740adc14
.NET SDKs installed:
5.0.201 [C:\Program Files\dotnet\sdk]
5.0.202 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.27 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.27 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.27 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Is there an existing issue for this?
Describe the bug
The following issue happens when logout
The info in the address bar
The info in the page
The Blazor WebAssmbly is able to login and logout via the steps mentioned in the reproduce section.
However, the logout process will not trigger the logout callback function.
The more strange thing is if refresh the page after login, and then logout. The issue mentioned in the #31088 occurs but logout callback function is triggered. The solution in that issue doesn't help.
Expected Behavior
The callback function for
OnLogOutSucceededwill always be called when logout succeeds.Steps To Reproduce
Use the code in this repo as the base.
Then replace the Authentication.razor with the following code
appsettings.jsonof client projectExceptions (if any)
No response
.NET Version
5.0.202
Anything else?
$ dotnet --info
.NET SDK (reflecting any global.json):
Version: 5.0.202
Commit: db7cc87d51
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19041
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.202\
Host (useful for support):
Version: 5.0.5
Commit: 2f740adc14
.NET SDKs installed:
5.0.201 [C:\Program Files\dotnet\sdk]
5.0.202 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.27 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.27 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.27 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]