---
title: "Discussion on \"Guide to Authentication with Access and Refresh Tokens in React/Next.js\" | Hashnode"
description: "Discussion on \"Guide to Authentication with Access and Refresh Tokens in React/Next.js\". Introduction\nBefore allowing access to a resource or service, authentication is the process of confirming a user's or system's identity. Making sure that only authorized users may engage with the system is the first and most important step in protect..."
url: "https://hashnode.com/posts/guide-to-authentication-with-access-and-refresh-tokens-in-reactnextjs/675c11f06458f516d0556c7b"
---

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

Discussion

# [Guide to Authentication with Access and Refresh Tokens in React/Next.js](https://sudo-coder.hashnode.dev/guide-to-authentication-with-access-and-refresh-tokens-in-reactnextjs?utm_source=hashnode&utm_medium=feed)

Introduction Before allowing access to a resource or service, authentication is the process of confirming a user's or system's identity. Making sure that only authorized users may engage with the system is the first and most important step in protect...

Dec 13, 2024 · 6 min read · sudo-coder.hashnode.dev  
Read the article

-   [#authentication](https://hashnode.com/tag/authentication)
-   [#jwt](https://hashnode.com/tag/jwt)
-   [#access-token](https://hashnode.com/tag/access-token)
-   [#refresh-token](https://hashnode.com/tag/refresh-token)
-   [#react-query](https://hashnode.com/tag/react-query)

## Written by

[Sudipta Pradhan](https://hashnode.com/@sudodev)

@sudodev

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

## Responses 2

Markdown supported · ⌘↵ to post

[Sudipta Pradhan](https://hashnode.com/@sudodev)

[Dec 16, 2024](https://hashnode.com/posts/guide-to-authentication-with-access-and-refresh-tokens-in-reactnextjs/675c11f06458f516d0556c7b/comment/675fde8b6031c9ae6104f861)

Yes, i think directly passing cookies in header is a secure option. But it gets directly passed into a separate header called cookie and not Authorization as far as I am aware. I will try to explore if we can pass it directly into Authorization. Thank you for the suggestion.

[Priyanshu Raj](https://hashnode.com/@priyanshu-raj)

[Dec 15, 2024](https://hashnode.com/posts/guide-to-authentication-with-access-and-refresh-tokens-in-reactnextjs/675c11f06458f516d0556c7b/comment/675ed8ca12a63a4479ed2efc)

Is it possible to access a JWT token stored in an HttpOnly cookie using Nookies?

If the API base path and browser base path are the same, the HttpOnly cookie is automatically included in the request headers. In such a case, is it more secure to avoid explicitly passing the token in the Authorization header?
