ASP.Net Core Web API JWT Tutorial [Using JWT in ASP.Net Core]

Поделиться
HTML-код
  • Опубликовано: 28 дек 2024

Комментарии • 12

  • @CodingDroplets
    @CodingDroplets  4 месяца назад

    🌟 Get Source Code: www.patreon.com/CodingDroplets

  • @Flash11I19
    @Flash11I19 12 дней назад +3

    Why didn't you create a refresh token?

    • @CodingDroplets
      @CodingDroplets  9 дней назад

      Great question! I’ll be covering refresh tokens in an upcoming video soon, so stay tuned. Thanks for watching and for your feedback!

  • @muhammadasaad1314
    @muhammadasaad1314 4 месяца назад +1

    hey i want to apply authorization in crud operations meaning only admin can add or delete the users or products others cannot . do u have a video on it or please make one i am looking for an easy way to do that

    • @CodingDroplets
      @CodingDroplets  4 месяца назад

      You can easily implement role-based authorization by adding "ClaimTypes.Role" to the claims during user authentication. Then, when assigning the [Authorize] attribute to your CRUD operations, specify the role that is allowed to perform those actions.

  • @HasnaSiyad-t6z
    @HasnaSiyad-t6z 4 месяца назад +1

    Great video, Thank you so much. I followed everything and jwt authorizing worked well, but unfortunately the token is not getting expired after the desired time. what may be the reason?

    • @CodingDroplets
      @CodingDroplets  4 месяца назад

      Thank you so much for your kind words! I'm really glad the video was helpful for you. The token expiration should work as I demonstrated. But there might be a slight delay of up to 5 minutes because of the default ClockSkew setting. If you'd like to remove that delay, you can set 'ClockSkew = TimeSpan.Zero' in your token validation parameters. This will make sure the token expires exactly when it’s supposed to.

    • @HasnaSiyad-t6z
      @HasnaSiyad-t6z 4 месяца назад

      @@CodingDroplets ya its worked, Thank you🙂

  • @OrakzaiSays
    @OrakzaiSays 3 месяца назад +1

    Technically the code is in wrong places. Like the jwt Service should only contain logic specific to JWT token generation, hashing, verification. LoginService or UserService should handle saving and checking user in EF

    • @CodingDroplets
      @CodingDroplets  3 месяца назад

      Thanks for your feedback! As you mentioned, JWT service should indeed focus solely on token generation and validation. Since the video is primarily focused on JWT authentication, I didn’t dive deeply into service creation and structuring.

  • @RudraPratapSinghLearning
    @RudraPratapSinghLearning Месяц назад +1