---
title: "Discussion on \"Handling Refresh Token with Next.js, Auth.js (next-auth v5) Credentials Provider, and HTTPOnly Cookie\" | Hashnode"
description: "Discussion on \"Handling Refresh Token with Next.js, Auth.js (next-auth v5) Credentials Provider, and HTTPOnly Cookie\". Using Server Actions and Axios Interceptors"
url: "https://hashnode.com/posts/handling-refresh-token-with-nextjs-authjs-next-auth-v5-credentials-provider-and-httponly-cookie/66f7425943dc61dba90f29b2"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Handling Refresh Token with Next.js, Auth.js (next-auth v5) Credentials Provider, and HTTPOnly Cookie](https://cherylm.hashnode.dev/handling-refresh-token-with-nextjs-authjs-next-auth-v5-credentials-provider-and-httponly-cookie?utm_source=hashnode&utm_medium=feed)

Using Server Actions and Axios Interceptors

Sep 27, 2024 · 7 min read · cherylm.hashnode.dev  
Read the article

-   [#next-auth-v5](https://hashnode.com/tag/next-auth-v5)
-   [#nextjs](https://hashnode.com/tag/nextjs)
-   [#authentication](https://hashnode.com/tag/authentication)
-   [#refresh-token](https://hashnode.com/tag/refresh-token)
-   [#authjs](https://hashnode.com/tag/authjs)
-   [#http-cookies](https://hashnode.com/tag/http-cookies)

## Written by

[Cheryl M](https://hashnode.com/@cherylm)

@cherylm · Australia

  
[View profile](https://hashnode.com/@cherylm)

Fullstack Web Developer

## Responses 2

Markdown supported · ⌘↵ to post

[Hoàng Nguyễn Huy](https://hashnode.com/@huyhoang2412)

[Dec 8, 2025](https://hashnode.com/posts/handling-refresh-token-with-nextjs-authjs-next-auth-v5-credentials-provider-and-httponly-cookie/66f7425943dc61dba90f29b2/comment/6936ebbcd8938218c048e2c7)

Thanks for sharing. But I have a question? For example, I have a getting data function in a server component (await get...), so when I request from browser and access token is expired, how can I refresh token. It's mean, in this case, we do not use the server action or route handle

[Mohamed Mouloudj](https://hashnode.com/@MohamedMouloudj)

[Sep 14, 2025](https://hashnode.com/posts/handling-refresh-token-with-nextjs-authjs-next-auth-v5-credentials-provider-and-httponly-cookie/66f7425943dc61dba90f29b2/comment/68c737681caaa7d0129f6296)

Fire 🔥, even after these years, your approach still works (with some changes oc). Your explanation is so simple and clear 🎯
