My Blazor App, https:// localhost:5001/app
但在我登录之后,Austh0总是回到https:// localhost:5001
我如何能够改变这种状况?
这里是我如何登记这项服务:
builder.Services.AddOidcAuthentication(options =>
{
builder.Configuration.Bind("Auth0", options.ProviderOptions);
options.ProviderOptions.DefaultScopes.Add("email");
options.ProviderOptions.AdditionalProviderParameters.Add("audience", (string)builder.Configuration["Auth0:Audience"]!);
options.ProviderOptions.AdditionalProviderParameters.Add("prompt", "select_account");
// options.ProviderOptions.AdditionalProviderParameters.Add("returnTo", "https://localhost:5001/app"); <== NOT WORKING
});
这里是我的认可部分:
@page "/app/authentication/{action}"
@using Microsoft.Extensions.Configuration
@inject NavigationManager Nav
<RemoteAuthenticatorView Action="@Action" OnLogInSucceeded=@loginHandler OnLogOutSucceeded=@logoutHandler>
<LogOut>
@{
var authority = (string)Configuration["Auth0:Authority"]!;
var clientId = (string)Configuration["Auth0:ClientId"]!;
var returnTo = "https://localhost:5001/app";
Nav.NavigateTo($"{authority}/v2/logout?client_id={clientId}&returnTo={returnTo}");
}
</LogOut>
</RemoteAuthenticatorView>
@code {
[Parameter]
public string? Action { get; set; }
private void loginHandler() {}
private void logoutHandler() {}
}