Jump to content

Sending JWT tokens to the server


NotionCommotion

Recommended Posts

Tried out JWT tokens for the first time.  The logon form sends username/password to the server via Ajax, and the server authenticates using normal practices and returns {jwt:xyz}  with 200 or an error message with 401.  From now on, I will either be doing Ajax/XMLHttpRequest requests or normal HTML requests (what the heck is the right word for a "normal" request?).

 

Reading about JWT tokens, it sounds like I want to send the header back on each request.  How does one send it to the server?  I could just use JavaScript to store it in a cookie, and then it will be sent on all requests, right?  If it is so simple, why have people written all these blogs about sending as a header?  Granted, I suppose cookies are a header, but I don't think that is what people were writing about.  I suppose I could store it in HTML5 storage, but then I think I will need to implement a bunch of JS to send when accessing a href link.

 

Thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.