Are you familiar with the OAuth2/OpenID Connect workflow? It answers most of your questions but maybe a bit more involved than using JWTs straight out of the box/package.
JWT Usage - First timer
Hi Guys,
I am implementing JWT tokens into one of my projects for the first time, using: https://github.com/tymondesigns/jwt-auth All is going well on the Laravel integration part, but I am looking for some opinions / advise on how to implement this on the consumer side.
My API will be consumed by various other CMS'es (Wordpress, Drupal, some custom work etc etc). Now, how do I handle the JWT tokens, once I receive it from the API, when considering the following scenarios:
-
User login: Do I request a new token on each login? Or do I store the token on the consumer side and first validate if the token that is currently saved there is still valid?
-
User Profile: The users' profile is stored on the API side. So if a users wants to change his profile, do I request a new token for this or do I try to re-use (if still valid) a previous token?
-
How do I handle the request of a new token? For example: A user logs in and is doing some stuff on the consumer side (that does not require the token) and then want to change his profile information (that DOES require a valid token), but the token expired in the mean time. Do we ask the user to re-authenticate itself, in orde to receive a new token or...?
If any additional clarification is needed, please do not hesitate to tell me.
Many thanks in advance.
Please or to participate in this conversation.