Part 1️⃣| Create JWT, role-based and refresh token in .NET 8 Blazor Interactive Server application

  Рет қаралды 11,885

Netcode-Hub

Netcode-Hub

Күн бұрын

Are you looking for Coding Mentoring? If you're seeking personalized guidance and mentoring for your coding journey, then get in touch!. I offer expert guidance and support to help you level up your programming skills. Contact me on business.netcodehub@gmail.com to book a session and accelerate your coding career.
/*Source code available*/
🔹www.buymeacoff...
/*Related*/
[Part 1️⃣] : Create JWT authentication: • Part 1️⃣| Create JWT, ...
[Part 2️⃣] : Consume authentication in Blazor Interactive Server: • Part 2️⃣ | Consume Rol...
[Full Course]: Create and consume JWT auth in Blazor: • Completely master JWT ...
Here's a follow-up section to encourage engagement and support for Netcode-Hub:
🌟 Get in touch with Netcode-Hub! 📫
🔹 GitHub: (github.com/Net...) 🌐
🔹 Twitter: ( / netcodehub ) 🐦
🔹 Facebook: ( / netcodehub ) 📘
🔹 LinkedIn: ( / netcode-hub-90b188258 ) 🔗
🔹 Email: [business.netcodehub@gmail.com]📧
☕️ If you've found value in Netcode-Hub's work, consider supporting the channel with a coffee!
🔹Buy Me a Coffee: (www.buymeacoff...) ☕️

Пікірлер: 46
@TV-mx4ei
@TV-mx4ei 8 ай бұрын
Thank you. I've been waiting for this! I'll be the first viewer.
@Netcode-Hub
@Netcode-Hub 8 ай бұрын
Now you have it, enjoy😀
@mesutdemirci7933
@mesutdemirci7933 8 ай бұрын
Thank you..avosome video..greating from turkey.
@Netcode-Hub
@Netcode-Hub 8 ай бұрын
My pleasure 😇
@cjt9150
@cjt9150 8 ай бұрын
Wow, amazing teaching, thank you netcode hub, liked and shared. and I want to know how the authorize attribute works in API, how it checkes the validity of token with user. could you please explain, and what happens if I simply assigns any token with valid duration with improver credentials.
@Netcode-Hub
@Netcode-Hub 8 ай бұрын
Token validity is being checked by the token service not the attribute In service registration , you made this happened; Validate Lifetime = true This does the magic. The attribute there make it available to check whether you have the token with specific role is specified. The service also check for the token formation it is coming in if it corresponds with it token formation using your key specified in appsettings.json file . The next video will explain it better . Watch it out thus implementing refresh token and role based authorization . It will be ready soon. 😂
@cjt9150
@cjt9150 8 ай бұрын
Thank you very much. Awesome
@Netcode-Hub
@Netcode-Hub 8 ай бұрын
The pleasure is mine
@yogeshgodse7372
@yogeshgodse7372 8 күн бұрын
Hi Thank very much for this video. I have one question, currently on application load home page is displayed how can we display login page if user is not authenticated on application load. Thank u
@Netcode-Hub
@Netcode-Hub 7 күн бұрын
Check if the user is not authenticated , send to login , change the main layout and create authentication layout
@yogeshgodse7372
@yogeshgodse7372 5 күн бұрын
Thank you for your response. What changes we have to make in route.razor page and what you mean by hangs main layout and create authentication layout. Thank you
@Netcode-Hub
@Netcode-Hub 5 күн бұрын
This video will show you how to creat layout and use Master Multiple Layouts in Blazor 🚀 | Build Dynamic & Scalable Web Apps with Ease! kzbin.info/www/bejne/nnO7aYeYhqh4fqs Check it out
@yogeshgodse7372
@yogeshgodse7372 4 күн бұрын
Thank you so much
@BarriDuty
@BarriDuty 8 ай бұрын
is there any considerations when implementing jwt in a blazor auto mode?
@Netcode-Hub
@Netcode-Hub 8 ай бұрын
Thinking about it
@MirzaBaig-rx4cw
@MirzaBaig-rx4cw 5 ай бұрын
You are life saver bro (Y)
@Netcode-Hub
@Netcode-Hub 5 ай бұрын
😃
@aloisemukoma8701
@aloisemukoma8701 8 ай бұрын
i am here to stay
@Netcode-Hub
@Netcode-Hub 8 ай бұрын
Thus good news Keep staying coz I have goodies for you
@minidragon76
@minidragon76 8 ай бұрын
Thank you for such a great course. I'm studying Blaze Server. Will the jwt course continue for servers? Also, how do you handle token expiration? \var token = new JwtSecurityToken( issuer : _configuration["Jwt:Issuer"], audience : _configuration["Jwt:Audience"], claims : userClaims, expires: DateTime.UtcNow.AddSeconds(5); signingCredentials : credentials ); Even if you set it to 5 seconds, the login function remains active when moving to another page. Thank you so much
@Netcode-Hub
@Netcode-Hub 8 ай бұрын
Will have a look on that
@DE-gp1nn
@DE-gp1nn 6 ай бұрын
You can add checking for yourself in GetAuthenticationStateAsync() if (getUserClaims.Expiration < DateTime.Now) return await Task.FromResult(new AuthenticationState(anymous));
@gugchil
@gugchil 6 ай бұрын
Is it really a good idea to keep the JWToken in a static property as you did? public static class Constants{ public static string JWToken{get;set;} } I mean will that static value be shared between different users sessions ??
@Netcode-Hub
@Netcode-Hub 5 ай бұрын
Instance will be created per user, keeping token in the server memory is not the good idea, maybe you can find a way out of saving it in various storage locations ….
@gugchil
@gugchil 5 ай бұрын
@@Netcode-Hub the problem with local storage is that it is not available in server-side or interactive auto render mode, so you cannot use it.
@herczegzoltan92
@herczegzoltan92 8 ай бұрын
Could pls you make a video about jwt web api deployment to azure?
@Gauravkumar-jm4ve
@Gauravkumar-jm4ve 8 ай бұрын
how did u generate the Key?
@Netcode-Hub
@Netcode-Hub 8 ай бұрын
www.random.org/strings/
@WilliamB-mn5fx
@WilliamB-mn5fx 6 ай бұрын
Can you do the same with IdentityDbContext ? U uploaded one but using web assembly local storage but I’m Using interactive server render mode, Great video thank u.
@Netcode-Hub
@Netcode-Hub 6 ай бұрын
Yes
@urbananan7080
@urbananan7080 3 ай бұрын
For some reason, even after adding AuthenticationHeaderValue, I cannot access the weather query with the [Authorize] attribute. Can I somehow get a copy of the project from the video?
@Netcode-Hub
@Netcode-Hub 3 ай бұрын
Sorry for that. Kindly check the video description
@urbananan7080
@urbananan7080 3 ай бұрын
@@Netcode-Hub Oh, sorry, it turned out to be because of my inattention. Thanks
@Netcode-Hub
@Netcode-Hub 3 ай бұрын
@urbananan7080 thus great , keep up 😃
@Kaps79
@Kaps79 6 ай бұрын
This is a nice video you put, however I wasn't able to use it because of the static JwtToken that you used. Once logged in, I opened the site into different browsers and the same login was working (because of the shared token). I tried to store token into a cookie instead of the static variable but didn't work for me :(
@Netcode-Hub
@Netcode-Hub 6 ай бұрын
You can save to to cookie , local storage arc…
@italhaayt
@italhaayt 2 ай бұрын
@@Netcode-Hub can you show us a demo for that
@italhaayt
@italhaayt 2 ай бұрын
could you resolve this ??
@PouriaPr
@PouriaPr 3 ай бұрын
thanks , now how to keep this jwt , after all reloading user must login again !
@Netcode-Hub
@Netcode-Hub 3 ай бұрын
😃 implement local or session storage
@PouriaPr
@PouriaPr 3 ай бұрын
@@Netcode-Hub aa,,, i use cookie it beter for server prerender , work fine now thank u
@italhaayt
@italhaayt 2 ай бұрын
@@Netcode-Hub how ?
@melenefoti
@melenefoti 7 ай бұрын
Very nice video, helpful. I did something similar but instead of using in routes.razor i added "builder.Services.AddCascadingAuthenticationState()" as they suggest for .Net 8. I just have one question for you, the login / logout and the authorization is working. But after i login and view a page.razor with @attribute [Authorize] if i press F5 on the browser i get an exception "InvalidOperationException: Unable to find the required 'IAuthenticationService' service....". Have you tried that? you have the same behavior in your project?
@Netcode-Hub
@Netcode-Hub 6 ай бұрын
Great
Help Me Celebrate! 😍🙏
00:35
Alan Chikin Chow
Рет қаралды 58 МЛН
The Joker wanted to stand at the front, but unexpectedly was beaten up by Officer Rabbit
00:12
إخفاء الطعام سرًا تحت الطاولة للتناول لاحقًا 😏🍽️
00:28
حرف إبداعية للمنزل في 5 دقائق
Рет қаралды 43 МЛН
The AI-Powered VS Code Killer? Checking Out Cursor and AI Coding
26:33
Milan Jovanović
Рет қаралды 13 М.
Brutally honest advice for new .NET Web Developers
7:19
Ed Andersen
Рет қаралды 203 М.
The Alternative to Deleting Data in .NET
11:11
Nick Chapsas
Рет қаралды 31 М.
Do NOT Learn Kubernetes Without Knowing These Concepts...
13:01
Travis Media
Рет қаралды 298 М.
Stop Using FirstOrDefault in .NET! | Code Cop #021
12:54
Nick Chapsas
Рет қаралды 78 М.