KHEN CAHYO

How Refresh Token Works as Authentication on a Application?

Nov 20, 2026 • BY Khen Cahyo

How Refresh Token Works as Authentication on a Application?

In this article, I want to talk about how Refresh Token works as Authentication on a Application.

How Refresh Token Works as Authentication on a Application?

Hello everyone, this is my first article on Medium. In this article, I want to talk about how Refresh Token works as Authentication on a Application. I want to discuss this because some people maybe not know about it and maybe misunderstand it. Let’s talk about it.

First, we need to know what is Access Token and Refresh Token, because they complement each other.

Access Token : This is a token given by the app after we have successfully authenticated. We can use this token to access some information that is protected by an application. For example, such as user data (our own data), and Access Token usually have an expiry time within a certain period of time.

Refresh Token : This is a token that is given along with the Access Token after out authentication process is successful. We use this token to update or request a new Access Token without having to ask our application users to re-login. Just like the Access Token, this token also has an expiry time within a certain period of time, but the expiry time of this token is longer than the Access Token.

Next, how do they works? Let’s take a look at the image below.

How Refresh Token Works

Let’s discuss the steps in the image above so that it looks clearer and easier for us to understand.

First, we need to authenticate the app with send our credentials.

Backend Server will send access token and refresh token to us.

The Frontend Server that receives the token will store the token in the browser storage (we can store it in Local Storage or Cookies).

Now, users can access certain information protected by the app by sending the access token every time they make a request.

When the access token has expired, the Frontend Server will automatically request a new access token by sending a refresh token that has been stored previously and replacing the expired access token with the newly obtained access token (in this case, we can use HTTP Interceptors).

The use of refresh tokens is very beneficial for the user experience when using our application. Imagine an active user in using our application and every time the user’s token access has expired, the user is asked to log in again to get new token access, very annoying right? Therefore, we can use this refresh token method.

So, do you want to use the refresh token method? Wellhhh, you can consider it.

CONTACT

Let's connect