How to implement Google Authetication in Blazor Web app without Core Identity

Iftekhar Ahammed 0 Reputation points

I would like to use custom authentication without using out-of-the-box Core Identity in my Blazor Web App with Oauth authentication.

I started the app using the template without using individual user account because we have our own registration and login page.

A set of technologies in the .NET Framework for building web applications and XML web services.
4,241 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce ( 57,891 Reputation points

    you don't give any info, the authentication flows are all pretty similar.

    • when your Blazor app need Authentication it redirects to the login server passing reply information, such as the reply url, and app id. this step unloads the Blazor app.
    • the login server authenticates the user and redirect back to the reply url
    • the reply url (typically a razor page or mvc controller) reads the ticket info and builds the user principal. if cookie authentication, the principal is serialized to a cookie. if token, it is passed on the url (if access tokens are required, typically they are cached key by user). the reply url page redirects to the Blazor host page.
    • the Blazor host page reads the cookie or passed token and build a user principal that is added as a scoped service. the host page the loads a pre-render Blazor app.
    • the Blazor pre-render reads the user from scoped services, and adds to the authentication state provider. The pre-render state needs to be persisted to response html. the pre-render response html is sent to the browser
    • the browser load the pre-render response, and either open signal/r connection to new Blazor server instance or loads a Blazor WASM app instance.
    • the new Blazor instance loads pre-render state info and creates a new authentication state provider with the saved state.
    0 comments No comments