.NET 8 Blazor Core-Hosted opt-in Cookie authentication 🔐🚀

Поділитися
Вставка
  • Опубліковано 9 лис 2024

КОМЕНТАРІ • 44

  • @KepaWong
    @KepaWong 11 місяців тому +2

    Very good! Yes, continue on with the refresh token. 😀

  • @ricardothomas3779
    @ricardothomas3779 Рік тому +4

    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.

  • @MihaiMoisei
    @MihaiMoisei Рік тому +2

    Thanks. I would like to see the Token-Refresh implementation.

  • @waynehawkins654
    @waynehawkins654 11 місяців тому +2

    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.

    • @Netcode-Hub
      @Netcode-Hub  11 місяців тому +1

      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

  • @rifatburaktozkoparan1454
    @rifatburaktozkoparan1454 10 місяців тому +1

    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?

    • @Netcode-Hub
      @Netcode-Hub  10 місяців тому +1

      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

  • @MartinGramblicka-s3s
    @MartinGramblicka-s3s 9 місяців тому

    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

  • @christiangerard4946
    @christiangerard4946 8 місяців тому

    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
      @Netcode-Hub  8 місяців тому

      Clean, Rebuild and run
      I belief this is from visual studio

    • @christiangerard4946
      @christiangerard4946 8 місяців тому

      @@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.

    • @Netcode-Hub
      @Netcode-Hub  8 місяців тому

      thus great

  • @kuldeepy-i4s
    @kuldeepy-i4s 10 місяців тому

    Awesome!!, please make a video on how to use Azure Active Directory Authentication🙏🙏

  • @patrickmakanga7569
    @patrickmakanga7569 10 місяців тому

    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

    • @Netcode-Hub
      @Netcode-Hub  10 місяців тому

      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 ?

    • @patrickmakanga7569
      @patrickmakanga7569 9 місяців тому

      @@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

  • @AMIRKHAN-dm2fm
    @AMIRKHAN-dm2fm Рік тому +1

    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?

    • @Netcode-Hub
      @Netcode-Hub  Рік тому +2

      Thanks for your comment , are you talking about how to pass JWT token to HttpClient header?

    • @AMIRKHAN-dm2fm
      @AMIRKHAN-dm2fm Рік тому +1

      @@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

    • @Netcode-Hub
      @Netcode-Hub  Рік тому +1

      @@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.

    • @AMIRKHAN-dm2fm
      @AMIRKHAN-dm2fm Рік тому +1

      @@Netcode-Hub yes i read the docs but i found nothing about authorization header.
      can you please make a tutorial?

    • @Netcode-Hub
      @Netcode-Hub  Рік тому

      @@AMIRKHAN-dm2fm can you show how you are doing it

  • @waynehawkins654
    @waynehawkins654 11 місяців тому +1

    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.

    • @Netcode-Hub
      @Netcode-Hub  11 місяців тому +1

      Awwww, 🥰. Thank you soo much . I am really grateful 🥲

    • @waynehawkins654
      @waynehawkins654 11 місяців тому +1

      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.

    • @Netcode-Hub
      @Netcode-Hub  11 місяців тому

      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.

  • @FearGod123
    @FearGod123 Рік тому +2

    Thank you very much!

    • @Netcode-Hub
      @Netcode-Hub  Рік тому

      The pleasure is mine 😀🥰

    • @FearGod123
      @FearGod123 Рік тому +1

      Hi @@Netcode-Hub , you did a great work. Your videos and code are very helpful. God bless you!

    • @Netcode-Hub
      @Netcode-Hub  Рік тому

      @@FearGod123 🙏 Amen! and bless you too

  • @ernestomartintorresgarcia4124
    @ernestomartintorresgarcia4124 11 місяців тому +1

    you don't have this exercise without the package WebAssembly.Server ? only with asp net core web api ?

    • @Netcode-Hub
      @Netcode-Hub  11 місяців тому +1

      .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 😊

  • @kourosh234
    @kourosh234 6 місяців тому

    what is this endpoint stuff worth if you can not change the registerrequest model?!!!

    • @Netcode-Hub
      @Netcode-Hub  6 місяців тому

      It is worth for simple app with simple and already made authentication system . 😆

  • @nickolmo1
    @nickolmo1 8 місяців тому

    how you comsume a external API like poke api?

    • @Netcode-Hub
      @Netcode-Hub  8 місяців тому

      What is poke API?

    • @nickolmo1
      @nickolmo1 8 місяців тому

      @@Netcode-Hub pokemon api XD