Search code examples
azure-web-app-serviceblazoropenid-connectblazor-webassemblyazure-static-web-app

Can I specify callback URL on built-in OIDC Authentication call from Blazor static web app WASM?


I call "/.auth/login/google" (or other providers) from my Blazor static web app. Once the user consents, control is routed back to the index page. Is there a way to specify that I'd like a different return page, e.g. via something like "/.auth/login/google?callback=http..."?


Solution

  • Inside of an Azure Static Web App (saying Static Blazor App I am assuming that you are using an Azure Static Web App) the query param is: post_login_redirect_uri rather than the callback that you are using.

    https://learn.microsoft.com/en-us/azure/static-web-apps/authentication-authorization#set-up-post-sign-in-redirect

    The route to the redirect page is relative to the login page itself so if you have 2 routes in your BLazor app:

    • index
    • redirect

    then the link to the login page would be /.auth/login/google?post_login_redirect_uri=/redirect