简体   繁体   中英

How to store JWT in cookies when using ReactJS

I want to store JWT in cookies and set HttpOnly flag as well. is that possible with react ?

We can not set a cookie with the HttpOnly flag in the client side (this includes React, Angular and any other client framework).

The HttpOnly is an additional flag included in a Set-Cookie HTTP response header.

Using the HttpOnly flag when generating a cookie helps mitigate the risk of client side script accessing the protected cookie (if the browser supports it).

For more information read here: HttpOnly

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM