The basic sequence of getting tokens is as follows: A client sends a username/password combination to the server. The server validates the authentication. If authentication is successful, the server creates a JWT token and refresh token else establishes an error response. On successful authentication, the client gets a JWT token in the response body and a refresh token in the cookie with all cookie protection flags like (httpOnly, secure=true, and SameSite=strict flag [whenever possible to prevent CSRF]). The client stores the access token in-memory. It means that you put this access token in a variable in your front-end site (like const accessToken = xyz). Yes, this means that the access token will be gone if the user switches tabs or refreshes the site. That’s why we have the refresh token. We’re not putting this access token in localStorage or cookie via JavaScript because it’s easier for attackers to dump that data, making it more prone to be stolen via an XSS attack. We can also u...
A blog is all about cyber security, WAPT, VAPT, API Security Testing, Scripts, Automation and Random stuff