# Get Refresh Tokens - /authorize "state" parameter

**URL:** <https://community.auth0.com/t/get-refresh-tokens-authorize-state-parameter/85062>\
**Category:** Get Help\
**Tags:** api, refresh-tokens, management-api\
**Created:** [June 14, 2022, 7:10am UTC](https://community.auth0.com/t/get-refresh-tokens-authorize-state-parameter/85062 "2022-06-14T07:10:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![k.lee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/k.lee/32/33786_2.png) [@k.lee](https://community.auth0.com/u/k.lee)\
**Post date:** [June 14, 2022, 7:10am UTC](https://community.auth0.com/t/get-refresh-tokens-authorize-state-parameter/85062/1 "2022-06-14T07:10:09Z")

</div>

I’m trying to implement a flow using `auth0/nextjs` in which I add the access token in the header of API calls. Currently using `getAccessToken` method for this.

The idea is to call `getAccessToken` and if it fails (token expired), then:

1. Get a refresh token
2. Use the refresh token to obtain a new access token
3. Use this new access token

When trying to get a refresh token by following the [docs](https://auth0.com/docs/secure/tokens/refresh-tokens/get-refresh-tokens), I’m noticing that the we should include a `state` parameter in the request to `/authorize`. My question is how/where would I obtain the `state` parameter when calling the `/authorize` endpoint on the server-side?

---

<div class="post-metadata">

**Author:** ![lsanchezs](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@lsanchezs](https://community.auth0.com/u/lsanchezs)\
**Post date:** [July 24, 2023, 4:41pm UTC](https://community.auth0.com/t/get-refresh-tokens-authorize-state-parameter/85062/2 "2023-07-24T16:41:17Z")

</div>

This parameter is optional, but it strongly recommended use it.  
Usually SDKs generate it for us  
What for?:

> **[Prevent Attacks and Redirect Users with OAuth 2.0 State Parameters](https://auth0.com/docs/secure/attack-protection/state-parameters)**
>
> Describes how to use the state parameter in authentication requests to help prevent CSRF attacks and restore state

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [November 18, 2024, 11:29pm UTC](https://community.auth0.com/t/get-refresh-tokens-authorize-state-parameter/85062/3 "2024-11-18T23:29:23Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
