Retroactivly scaffolding identity into both my backend and frontend so that it all works

!Programming-proffesional 20 Reputation points

I've made 3 projects in my solution.
one is my Api project, one is my blazor project and one is a class library for my Dtos.
Both my backend and frontend reference the class library.

I wanna retroactivly scaffold identity into my backend for my users but i wanna add the pages to my frontend for the use of individual accounts in my application.

My frontend has a service pages to be able to contact and consume my backend endpoints

how would i go about fixing this?

A set of technologies in the .NET Framework for building web applications and XML web services.
4,371 questions
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,492 questions
ASP.NET: A set of technologies in the .NET Framework for building web applications and XML web services.API: A software intermediary that allows two applications to interact with each other.
317 questions
0 comments No comments
{count} votes

Accepted answer
  1. Bruce ( 61,026 Reputation points

    your question is not clear. will the front-end pass credentials to the backend? this would typically be a jwt token.

    scaffolding is for razor projects, so you would probably scaffold the backend. then add a controller action that return a jwt token for username / password. you would then create a blazor login page that calls the token api. repeat for any other identity pages you want.

    you will also want to create custom blazor authentication provider, and set the user and save jwt token on the blazor login page. you may also want to supply a refresh token api or just require a login when the token expires.

    if only the frontend will use authentication, then scaffold the UI. this will add razor pages for login, register, etc. your blazor app should redirect to razor login page when authentication is required. see sample blazor login control. you can also rewrite the login pages in blazor (again this will require a custom authentication provider). google for samples

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful