Skip to content

Add documentation for JWT authentication in Blazor #35225

Open
@MarvinKlein1508

Description

@MarvinKlein1508

Tell us what search terms you used and how you searched docs.

I've searched for JWT and authentification.

Tell us what docs you found that didn't address your concern.

Basically the entire tree here:
https://learn.microsoft.com/en-us/aspnet/core/blazor/security/?view=aspnetcore-9.0&tabs=visual-studio

Describe the new topic

Explain why this topic is needed.

Many people create ASP.NET Core Web Apis as backend for their applications. Those often rely on JWT authentification for their endpoints. Mixing blazor into all of this makes this a really complicated process. Literally any tutorial you find about this topic is differs from each other and there are no real best practices.

Should you even use JWT authentification in Blazor at all? If so how should you handle the different rendermodes?

In my example there endpoints for authentication right within the Web Api which return an access and refresh token which should be used to authenticate the user in the blazor app. The token shoudl also be applied to all requests from HttpClient.

Suggest a location in the Table of Contents.

This should be located right into the Blazor section.
https://learn.microsoft.com/en-us/aspnet/core/blazor/security/?view=aspnetcore-9.0&tabs=visual-studio

Write an abstract. In one short paragraph, describe what this topic will cover.

The docs should cover how to save the access and refresh token in the different blazor scenarios. As well as automatically fetching a new access token when it has been expired. Last but not least it should show how the access token should be attached to the HttpClient requests.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

P0/P1 - High Priority

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions