Access Token & Refresh Token

Access Token

  • Think of an access token like a key card that lets you enter a restricted area (like a gym or office).

  • It's a small piece of information that a server gives you after you've logged in successfully.

  • You show this key card (access token) each time you want to access something protected, like your user data or posting on social media.

  • Access tokens are short-lived, so they expire after a certain time to keep things secure.

Refresh Token

  • A refresh token is like having a magic card that renews your key card automatically.

  • It's a special card you keep safely that allows you to get a new access token without needing to log in again.

  • Refresh tokens last longer than access tokens and are used to get a new access token when the old one expires.

  • You use the refresh token to 'refresh' your access without bothering the server for your username and password again

MORE DETAILS