Introduction To Blazor Authentication in .NET 8

preview_player
Показать описание
Blazor Authentication can be a tricky subject in .NET 8. The reason for this is that authentication has drastrically changed when compared to how we implement it in earlier versions, no matter if Blazor WebAssembly or Blazor Server. Therefore in this video my aim is to walk you through what has changed and explain you exactly how authentication works in Blazor in .NET 8. We'll also tackle some common practical tasks like implementing a redirect to login and what could potentially go wrong there.

Join this channel to get source code access and other perks:

Also follow me here:

Content
1. Intro: 00:00
2. Authentication setup: 00:25
3. Middleware GOTCHA! 02:15
4. Authentication endpoints: 03:12
5. Email and Redirection services: 04:43
6. Revalidating Authentication State: 06:04
7. User registration: 09:06
8. Blazor Login Functionality: 11:46
9. See it in action: 12:48
10. Redirect to Login in Blazor: 14:00
11. Revalidating Authentication in action: 16:20
Рекомендации по теме
Комментарии
Автор

You're welcome! I've been searching for someone to explain this to us for a while. Keep explaining thoroughly. Thank you very much again.

Blazor
Автор

Thanks for this video. Auth is one topic that ive struggled with the most in trying to start a new real world project. Your explanations are super helpful! Especially since we have the need to uave kultiple apps share the same set of users

yatlor
Автор

Thank you. This makes it easier to understand.

rd_Century
Автор

Given that the .net 8 blazor auth covers so much
would you recommend using this out of the box setup over doing it from scratch like you previously did with the .net 6 blazor auth?

Dinesh
Автор

Thank you for the video aways very informative! What if I have a custom user table cominng from a legacy project that I want to use in the blazor server app? Let's say the table have just username, password and a Role in it without even the email. Is it possible to use the default implementation just by overridig some parts and in case wich ones? Or I have to create my custom Authentication from scratch?

ilFusta
Автор

It would be really helpfull if you would provide a github link in the video descriptions. A lot of times it's easyer to understand when you can freely scroll throwgh the code.

tapesteer
Автор

So now we can use that Identity User Accessor and we don't need to do the whole initial state and downloading everything from httpcontext only at the start of the application? Or does this only work for SSR and on SS we still need the old way?

Tymonello
Автор

When we have a global Authorize attribute, what other pages in the Account area would need an AllowAnonymous attribute?

realsk
Автор

Hi, how would you go around publishing this application and still use this way of login, do i need to migrate the user db context?

Great video, have been looking for something like this!

Angelrush
Автор

Is there a possibility of adding roles to this authentication? If so, how would you go about adding roles?

GewiSC
Автор

Thanks for the EXCELLENT video explaining .Net 8 Blazor Authentication. You make it feel so simple!
But I need to go a bit further. I have 3 applications and need to have a common Login Authentication and need to jump from one app to another. If I logout from on app then it has to logout on the others too (the same way you explained on the different tabs). How can I achieve this please?
JP

JPScerri
Автор

Any link to the example you went over in the video?

robertpurpose
Автор

Thank you for your video. But may i know, why with the default project setup(interactive server, individual identity), the session cookie still alive, when I just close the tab or web browser? When I open again the home page, it shows the login condition as same before?

goditto
Автор

Can you clarify how the pass the athuninctaion state to the client in template with individuals accounts and interactive auto

waleedbensumaidea
Автор

How do you handle 500+ claims for user permissions to avoid the header size limit? I'm currently working on a similar project and would love to hear about different strategies or experiences from the community. Any insights or advice would be greatly appreciated!

RicardoYanezColina
Автор

Excellent video. I dont understand well the email thing. When i want to implement a real email confirmation, I overwrite the IdentityNoOpEmailSender clas and thats it?

andresbeltran
Автор

Great video, thanks for this.
Just out of curiosity, have you considered trying Azure AD B2C for authentication/authorization?

majormartintibor
Автор

The in the in 8.0.X is never called, why?

codecell
Автор

Hello, I'm new to blazor framework, i created a Project of type blazor web app with dotnet 8 wich include both server and client project, and i added authentication and Authorization with jwt bearer and i save the token in browser, but i encountering a proplem when refrech a component with Attribute autorize, it's gives error 401 unautorize while oninizlation of the component i retrive the authentication state but it's give 401. And btw the rendermode on the component ia interactiveServer with prerender false, so can any one help me with this problem 🙏

mustafagamer
Автор

This is a constant issue for me when trying to search for information about this part. Like yes i can create the authorization at this point, and i have all that but i am really confused about how to use the cookie data to track which user is logged in...
Im a student so this is a student question really..
But in the web app that we are making, in blazor we need to make a site for a car rental company, and im just currious of how i keep track of the logged in user, like i want to see only the logged in users orders and order history, i want to be able to klick on a car and be sent to a booking site where we can just klick the rent car and have the logged in users informatin already inserted in the form except for the period of which the car should be rented.
Its a piece of information that seems really hard to find for some reason...

Drougar