I have a Blazor WASM app and an API for that client app. Now I'd like to decouple things and extract the authentication layer into it's own project an API.
So I'd have 4 projects(in reality there're also Domain, Infrastructre etc. projects but for the sake of this example I wanna keep it simple): - MyProject.BlazorClient - MyProject.HostApi - MyProject.Shared (would contain Models, DBContext etc.) - MyProject.Authentication.Api (should basically act like auth0 and manage authentication)
Purpose/use case: I would like to have a centralized authentication API like
accounts.myproject.tld
accounts.myproject.tld
which could be used for other services on that domain like
service1.myproject.tld
service1.myproject.tld
and
service2.myproject.tld
service2.myproject.tld
without the need of 2 separate authentication providers. So like I said, basically a "self hosted auth0".
Questions: 1. Are there any examples/tutorials/references of this available? Can't seem to find any and I don't want to reinvent the wheel 2. How can I secure my HostApi with the authentication server? 3. How can I implement authentication with this pattern in blazor? Do I need to configure the Blazor WASM app to use one API for authentication and another one for data retrieval? If so, how?