Open Closed

Redirect to Blazor WASM app after login from public site #6595


User avatar
0
Spospisil created
  • ABP Framework version: v7.3.0
  • UI Type: Blazor WASM
  • Database System: EF Core (PostgreSQL, etc..)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes

Using a tiered solution architecture generated from ABP, I would like to put a login button on the public web site that when the user successfully logs on will redirect to the Blazor WASM url instead of going back to the public web site as is currently the case with the out of box generated solution from ABP.

How can I accomplish this?


2 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You can try:

    Update the Public website's appsettings.json to add RedirectAllowedUrls

      "App": {
        "SelfUrl": "https://localhost:44304",
        "DisablePII": false,
        "RedirectAllowedUrls": "https://localhost:44307" // your blazor website URL
      },
    

    Open the YourProjectNameWebPublicModule to configure the AppUrlOptions

    Configure<AppUrlOptions>(options =>
    {
        options.Applications["MVC"].RootUrl = configuration["App:SelfUrl"];
        options.RedirectAllowedUrls.AddRange(configuration["App:RedirectAllowedUrls"]?.Split(',') ?? Array.Empty<string>()); // add this line
    });
    

    Finally, add the login button to the page

    <a class="btn btn-primary" href="/Account/Login?returnUrl=https://localhost:44307">login to blazor</a>

  • User Avatar
    0
    Spospisil created

    Thank you. That was the solution to my issue.

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11