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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.