Auth0 blazor auth and API client in one project #18
Replies: 2 comments 1 reply
-
Although you could do this in theory, I would argue this is an architectural problem rather than an implementation issue. If the API and SSR blazor are in the same project, then you should just be doing direct function calls or abstracting via mediator (if you need direct access as well as exposing an API) rather than wasting CPU cycles deserializing/serializing a payload and losing the net benefit of a server-side framework. |
Beta Was this translation helpful? Give feedback.
-
Hmm, That didn't answer my question. There are valid reasons behind why we need the Blazor server app calling these APIs as actual API endpoints rather than implementing any of the patterns you've described. I will carry on looking for answers elsewhere. Cheers. |
Beta Was this translation helpful? Give feedback.
-
Hey there,
I have a Blazor server app which requires standard web application authentication (so user logs in, can use the app, etc.), but on top of this, my Blazor server app also houses a number of API controllers which my blazor server code calls via HttpClients to perform app operations. Clearly, I'd like to secure both the blazor server app AND the API endpoints housed in the same solution. So when the user is authenticated with the web app, I can also then ensure that as they perform actions on the screens, an access token is made available to my http client which allows my blazor server code to call the secured internally-hosted API endpoints.
I was unclear from the docs / samples if this is possible using this library. I have tried using the stock standard Auth0 .NET tools to do so, but so far no luck.
If this is possible, can you give me some sense of how this is done. I'm happy to have a play with the samples to try and work it out, but any advice or details you can provide would be great.
Cheers
Beta Was this translation helpful? Give feedback.
All reactions