Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

How to specify the URL to return to after a successfull login with Auth0 and Blazor WASM?

$
0
0

My Blazor App runs on https://localhost:5001/app

But after I log in, Auth0 always returns to https://localhost:5001

How can I change that?

Here is how I register the service:

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});

And here is my Authentication component:

@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() {}}

Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>