DEV Community

Discussion on: How to Secure JWT in a Single-Page Application

Collapse
 
aymenmarouani profile image
Aymen Marouani

Thanks for the article, but I have a need where the JavaScript code have to read the token and send it in a HTTP authorization header (axios http equest), how can I achieve this feature ?

Collapse
 
edgaremmanuel profile image
DevByJESUS

If you havce store the Jwt somewhere , you can have a config that says that if the user is logged In , put the Token in the Authorization header in the Axios for each request to the Backend else do not create an Authorization header in the axios request

Some comments have been hidden by the post's author - find out more