-1

I want to implement jwt token based authentication in my application .But unable to figure out how to add this token in each and every request in frontend as well as where to store the token so we can pass on every request

I want to know how to pass bearer token from front end .And I am using JavaScript ,thymeleaf as frontend.

1 Answers1

0

Your jwt must be passed in the "Authorization" header in any request

Like this (with axios) :

axios.get(url, {
                headers: {
                    Authorization: `Bearer {your-access-token}`
                }
            });

For storage, many use localstorage but I advise you to read this before implementing anything: https://stackoverflow.com/a/44209185/11405229