Hello Frederick, Thank you for this video. Yes, I would like to see a video on the Token-Refresh. Also, please could you explain how to extend the Application User entity by adding custom fields, for example, adding a FirstName Field. If it is possible please could you do videos on use-cases for the other default identity endpoints as well. I am interested and I am sure others are too. Thanks again for this video.
Excellent video. You clearly know what your talking about. Question - After it builds the database with EF and I run and see all the options now show on the API website (register, logout, ...), but where is this coming from. I see no added Controllers on the project. I have added to the database my custom fields and now want to include in the API.
Thanks for your comment. The controller is opt-in, provided by the ASP.NET team. These endpoints are hidden. They did this for simple apps that need simple authentication. If you want to add more fields and more customizations then your need to customized/create your own endpoint . Check this video. I have be explained and shown you how to go about it . Unlock the Power: Customizing Identity Users in .NET 8 Core Web API Auth! 🔐 ua-cam.com/video/3DMbOjiUaZg/v-deo.html
Great video! Thank you!. A question : in this example anyone can register and become a user with already defined register endpoint, and there is no way to edit the code. We do not want that in real world application. Is there anyway to override this? like only admin role can call register endpoint. Otherwise there is no point in using this microsoft's identity?
Hello 👋, thanks for your comment . This opt in endpoint is for testing and small app. If you are building scalable apps then you will then need to use your own authentication system . You can do that with Identity Manager or JWT
Hi Frederick, Do you also have example of not only standalone blazor app but with Blazor web app (the one whitch supports both server-side rendering and client interactivity) connected to web api which handle also external account like microsoft and google? Thanks
Thanks, I found this tutorial very good and useful. I have a small issue: when I add a breakpoint in the c# code of a client page, I get the warning message :"The breakpoint will not be currently hit. No Symbols have been loaded for this document". Would you know how to solve this issue?
@@Netcode-Hub. Thank you for your prompt answer. I also think it comes from Visual Studio. I've tried clean end rebuild. I've also tried to repair visual studio but it's still the same. I'll keep exploring.
Hi Fredrick, This is super nice! thank you for the video please keep up the good work. A quick question are you able to implement the refresh token part and also able to do role based or policy based authorization dynamically without hard coding the roles. Such that particular menus can be viewed based on the assigned roles. Thanks you
Currently, the admin and change user role and can also delete user . The system has 2 roles :ADMIN & USER . The admin can update user role but the user cannot Is that what you wanted ?
@@Netcode-Hub Thank you for the feedback. I meant the ADMIN role to be in a position to view all the menus and USER role to be restricted i.e. be able to view selected menus i.e. based on the assigned permissions
Thanks very nice. i have a problem please let me know or share some content about how to pass jwt token in the request header when the apu client is generated by NSwag studio?
@@AMIRKHAN-dm2fm Ohk. Have you gone through the documentation please. learn.microsoft.com/en-us/aspnet/core/tutorials/getting-started-with-nswag?view=aspnetcore-7.0#:~:text=NSwagStudio%3A%20A%20Windows%20desktop%20app,The%20NSwag.
Again, thank you for your support on this. Amazing. I went and bought you 5 coffees for your hard work on this. Keep up the amazing work. PS - other watching. You should do the same if you got even close to what I got out of these videos.
Hi I have been following along and for me it's a Web App with both Server and Client project. That is a Auto project. I have my login.razor page in the Server side of things. All works until I get to this line and then I get the following. If I put this into a Blazor Component within a RCL project and then llink this componet to the login.razor page with pre-render:false. eg It's pass this line but don't update things. So a no still working this way. So the question is why? If I go like for like same as this video I get the following error... Why is it upset with this line await _localStorageService.SetItemAsStringAsync("Authentication", Serialize(model)); And it returns this... An unhandled exception occurred while processing the request. InvalidOperationException: JavaScript interop calls cannot be issued at this time. This is because the component is being statically rendered. When prerendering is enabled, JavaScript interop calls can only be performed during the OnAfterRenderAsync lifecycle method. I have spend a few hours on this and not sure why I'm getting this. Upset about the Blazored.LocalStorage at a guest.
Sorry for late reply , according to research🧐 . It seems that you are trying to use JavaScript interop in a Razor Class Library component that is statically rendered. This means that the component is not prerendered on the server and does not have access to the JavaScript runtime. According to the documentation, JavaScript interop calls can only be performed during the `OnAfterRenderAsync` lifecycle method when prerendering is enabled. This method is invoked after the component has been rendered on the server and before it is rendered on the client-side using Blazor WebAssembly. Therefore, if you want to use JavaScript interop in your Razor Class Library component, you need to do one of the following: - Enable prerendering for your Blazor Web App project by adding `Enable prerendering = true` to your app's `Program.cs` file - Move your JavaScript interop calls from the `OnInitializedAsync` or `OnAfterRenderAsync` methods to the `OnAfterRenderAsync` method of your Razor Class Library component. Hope this helps.
Very good! Yes, continue on with the refresh token. 😀
🫡
Hello Frederick,
Thank you for this video.
Yes, I would like to see a video on the Token-Refresh.
Also, please could you explain how to extend the Application User entity by adding custom fields, for example, adding a FirstName Field.
If it is possible please could you do videos on use-cases for the other default identity endpoints as well. I am interested and I am sure others are too.
Thanks again for this video.
😃 welcome 🙏
Thanks. I would like to see the Token-Refresh implementation.
Excellent video. You clearly know what your talking about.
Question - After it builds the database with EF and I run and see all the options now show on the API website (register, logout, ...), but where is this coming from. I see no added Controllers on the project. I have added to the database my custom fields and now want to include in the API.
Thanks for your comment. The controller is opt-in, provided by the ASP.NET team. These endpoints are hidden. They did this for simple apps that need simple authentication.
If you want to add more fields and more customizations then your need to customized/create your own endpoint . Check this video. I have be explained and shown you how to go about it .
Unlock the Power: Customizing Identity Users in .NET 8 Core Web API Auth! 🔐
ua-cam.com/video/3DMbOjiUaZg/v-deo.html
Great video! Thank you!. A question : in this example anyone can register and become a user with already defined register endpoint, and there is no way to edit the code. We do not want that in real world application. Is there anyway to override this? like only admin role can call register endpoint. Otherwise there is no point in using this microsoft's identity?
Hello 👋, thanks for your comment .
This opt in endpoint is for testing and small app. If you are building scalable apps then you will then need to use your own authentication system . You can do that with Identity Manager or JWT
Hi Frederick,
Do you also have example of not only standalone blazor app but with Blazor web app (the one whitch supports both server-side rendering and client interactivity) connected to web api which handle also external account like microsoft and google? Thanks
Ohk will see to it
Thanks, I found this tutorial very good and useful. I have a small issue: when I add a breakpoint in the c# code of a client page, I get the warning message :"The breakpoint will not be currently hit. No Symbols have been loaded for this document". Would you know how to solve this issue?
Clean, Rebuild and run
I belief this is from visual studio
@@Netcode-Hub. Thank you for your prompt answer. I also think it comes from Visual Studio. I've tried clean end rebuild. I've also tried to repair visual studio but it's still the same. I'll keep exploring.
thus great
Awesome!!, please make a video on how to use Azure Active Directory Authentication🙏🙏
Alright
Hi Fredrick,
This is super nice! thank you for the video please keep up the good work. A quick question are you able to implement the refresh token part and also able to do role based or policy based authorization dynamically without hard coding the roles. Such that particular menus can be viewed based on the assigned roles. Thanks you
Currently, the admin and change user role and can also delete user . The system has 2 roles :ADMIN & USER .
The admin can update user role but the user cannot
Is that what you wanted ?
@@Netcode-Hub Thank you for the feedback. I meant the ADMIN role to be in a position to view all the menus and USER role to be restricted i.e. be able to view selected menus i.e. based on the assigned permissions
Thanks very nice.
i have a problem please let me know or share some content about how to pass jwt token in the request header when the apu client is generated by NSwag studio?
Thanks for your comment , are you talking about how to pass JWT token to HttpClient header?
@@Netcode-Hub yes . in my scenario i am generating http client with nswag studio but not found how to send jwt token in the header.
Thanks
@@AMIRKHAN-dm2fm Ohk. Have you gone through the documentation please.
learn.microsoft.com/en-us/aspnet/core/tutorials/getting-started-with-nswag?view=aspnetcore-7.0#:~:text=NSwagStudio%3A%20A%20Windows%20desktop%20app,The%20NSwag.
@@Netcode-Hub yes i read the docs but i found nothing about authorization header.
can you please make a tutorial?
@@AMIRKHAN-dm2fm can you show how you are doing it
Again, thank you for your support on this. Amazing. I went and bought you 5 coffees for your hard work on this. Keep up the amazing work.
PS - other watching. You should do the same if you got even close to what I got out of these videos.
Awwww, 🥰. Thank you soo much . I am really grateful 🥲
Hi I have been following along and for me it's a Web App with both Server and Client project. That is a Auto project.
I have my login.razor page in the Server side of things.
All works until I get to this line and then I get the following. If I put this into a Blazor Component within a RCL project and then llink this componet to the login.razor page with pre-render:false.
eg
It's pass this line but don't update things. So a no still working this way.
So the question is why? If I go like for like same as this video I get the following error...
Why is it upset with this line
await _localStorageService.SetItemAsStringAsync("Authentication", Serialize(model));
And it returns this...
An unhandled exception occurred while processing the request.
InvalidOperationException: JavaScript interop calls cannot be issued at this time. This is because the component is being statically rendered. When prerendering is enabled, JavaScript interop calls can only be performed during the OnAfterRenderAsync lifecycle method.
I have spend a few hours on this and not sure why I'm getting this. Upset about the Blazored.LocalStorage at a guest.
Sorry for late reply , according to research🧐 .
It seems that you are trying to use JavaScript interop in a Razor Class Library component that is statically rendered. This means that the component is not prerendered on the server and does not have access to the JavaScript runtime.
According to the documentation, JavaScript interop calls can only be performed during the `OnAfterRenderAsync` lifecycle method when prerendering is enabled.
This method is invoked after the component has been rendered on the server and before it is rendered on the client-side using Blazor WebAssembly.
Therefore, if you want to use JavaScript interop in your Razor Class Library component, you need to do one of the following:
- Enable prerendering for your Blazor Web App project by adding `Enable prerendering = true` to your app's `Program.cs` file
- Move your JavaScript interop calls from the `OnInitializedAsync` or `OnAfterRenderAsync` methods to the `OnAfterRenderAsync` method of your Razor Class Library component.
Hope this helps.
Thank you very much!
The pleasure is mine 😀🥰
Hi @@Netcode-Hub , you did a great work. Your videos and code are very helpful. God bless you!
@@FearGod123 🙏 Amen! and bless you too
you don't have this exercise without the package WebAssembly.Server ? only with asp net core web api ?
.Net 8 Blazor Server app, has its unique way of authentication and authorization.
I have a video done it
Please check .Net 8 Blazor playlist
Thanks 😊
what is this endpoint stuff worth if you can not change the registerrequest model?!!!
It is worth for simple app with simple and already made authentication system . 😆
how you comsume a external API like poke api?
What is poke API?
@@Netcode-Hub pokemon api XD