PHP + Json Web Token (JWT) Tutorial

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

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

  • @themonster4759
    @themonster4759 Год назад +1

    you are The King Of PHP

  • @unknownunknown8573
    @unknownunknown8573 Год назад +1

    As always, great content! Thanks Gary!

  • @niknt
    @niknt 11 месяцев назад

    Thank you for this useful video. We can use JWT token to get an access to the API endpoint. Adding HTTP Header: "Authorization: Bearer " will help us. But what is a correct way of storing this access token in the application? Should we store it in the Database? Or maybe we should store this token in the cache (Redis, Memached)?

    • @GaryClarkeTech
      @GaryClarkeTech  11 месяцев назад +1

      It's a long answer which really depends on your application but memory or DB would be ok for server-side applications. For mobile or desktop, you'll more likely need to rely on something else...Keychain / Keystore / CredsLocker

  • @truthteachers
    @truthteachers Год назад

    Hi Gary, I was excited about the topic and then got disappointed when i realized too soon that it was linked into TDD and Pest. I was expecting a course JWT on its own with the test dependency. 😢

  • @jmmmmmmmmmk
    @jmmmmmmmmmk 8 месяцев назад

    Hello Does not https transfer data in encrypted form between client and sever
    Do we still need JWT?
    Can you elaborate on this please?

    • @GaryClarkeTech
      @GaryClarkeTech  8 месяцев назад +1

      JWT is used for authentication, not encryption.

    • @jmmmmmmmmmk
      @jmmmmmmmmmk 8 месяцев назад

      @@GaryClarkeTech thank you nice video

  • @Anthony99
    @Anthony99 7 месяцев назад

    Great video, thank you!! :-) Exceptional work... I gave a like & subscribed.

    • @GaryClarkeTech
      @GaryClarkeTech  7 месяцев назад

      Awesome, thank you!

    • @Anthony99
      @Anthony99 7 месяцев назад

      No problems at all... hopefully it helps! 🙂
      I was about to get to work writing JWT's into one of my web apps, although now I'm not sure what the advantage of using JWT is over sessions in PHP?
      I was originally going to do it because I'm having trouble with cookies expiring after 15 mins unattended (think its the web server)... then I read people say don't store JWT in local storage, only in cookies... but my cookies are expiring anyway, so JWT would die with the expired cookie.
      What do you think the key advantage to using a JWT is?
      Thanks for your time... :-)

  • @sliceem88
    @sliceem88 Год назад

    Tnx ! Perfect content !

  • @devfahim5933
    @devfahim5933 11 месяцев назад

    Hey Gary great content. I was trying to generate a secret base64 encoding (verify signature ). Can shortly give me an idea about that . How can i generate that.

    • @GaryClarkeTech
      @GaryClarkeTech  11 месяцев назад +1

      In php you can do something like this...this is a little simplified but you should get the idea
      // Your data and secret key
      $data = "Your data here";
      $secret_key = "your_secret_key";
      // Create a signature using a cryptographic hash function, e.g., SHA-256
      $signature = hash_hmac('sha256', $data, $secret_key, true);
      // Encode the signature in Base64
      $encoded_signature = base64_encode($signature);
      echo $encoded_signature;