Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass JSON Web Tokens to different web pages after successful login?

I have a set of web pages that makes use of some APIs that need JWT as a header for authentication. This JWT is generated after success login. What would be the most appropriate way of sending jwt from one page to another after a successful login?

like image 845
Shubham Avatar asked Dec 01 '25 10:12

Shubham


1 Answers

You can use either of these to store JWTs:

  1. HTML5 Web Storage (localStorage or sessionStorage)
  2. Cookies

As explained in this article store JWT in cookies for web applications, because of the additional security they provide.

What would be the most appropriate way of sending jwt from one page to another after a successful login?

Retrieve token from cookie/web storage in another page.

like image 100
Hemant Avatar answered Dec 03 '25 23:12

Hemant



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!