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

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

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

  • @CodingDroplets
    @CodingDroplets  Месяц назад

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

  • @user-up5lt6wj3u
    @user-up5lt6wj3u 29 дней назад +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  29 дней назад

      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.

    • @user-up5lt6wj3u
      @user-up5lt6wj3u 23 дня назад

      @@CodingDroplets ya its worked, Thank you🙂

  • @OrakzaiSays
    @OrakzaiSays 7 дней назад +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  7 дней назад

      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.

  • @muhammadasaad1314
    @muhammadasaad1314 Месяц назад +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  Месяц назад

      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.