# Refresh token Coming null

**URL:** <https://devforum.okta.com/t/refresh-token-coming-null/18773>\
**Category:** Questions\
**Tags:** spring, java\
**Created:** [January 6, 2022, 7:49am UTC](https://devforum.okta.com/t/refresh-token-coming-null/18773 "2022-01-06T07:49:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shreekucherla](https://avatars.discourse-cdn.com/v4/letter/s/ccd318/32.png) [@shreekucherla](https://devforum.okta.com/u/shreekucherla)\
**Post date:** [January 6, 2022, 7:49am UTC](https://devforum.okta.com/t/refresh-token-coming-null/18773/1 "2022-01-06T07:49:22Z")

</div>

Hi ,  
I am using spring with dynamic client registration with okta. When user tries to access the resources, app is redirecting to okta login. After a successful login with authorization\_flow with a grant type authorize\_code. I am getting access toke with all the details. But when i try to retrieve refresh\_token from authorization from context, I am getting null pointer exception. Any suggesstions / help is appreciated

Thanks  
Shree

---

<div class="post-metadata">

**Author:** ![phi1ipp](https://avatars.discourse-cdn.com/v4/letter/p/85f322/32.png) [@phi1ipp](https://devforum.okta.com/u/phi1ipp)\
**Post date:** [January 9, 2022, 12:12am UTC](https://devforum.okta.com/t/refresh-token-coming-null/18773/2 "2022-01-09T00:12:45Z")

</div>

Does the application support offline\_access flow? If not, refresh token won’t be sent

---

<div class="post-metadata">

**Author:** ![shreekucherla](https://avatars.discourse-cdn.com/v4/letter/s/ccd318/32.png) [@shreekucherla](https://devforum.okta.com/u/shreekucherla)\
**Post date:** [January 9, 2022, 4:38pm UTC](https://devforum.okta.com/t/refresh-token-coming-null/18773/3 "2022-01-09T16:38:30Z")

</div>

Could you please help me understand application supporting offline\_access. I have tried to send offline\_access as a scope. Is this something i set in okta app server ?. Appreciate the help

Thank you  
shree

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [January 10, 2022, 5:31pm UTC](https://devforum.okta.com/t/refresh-token-coming-null/18773/4 "2022-01-10T17:31:52Z")

</div>

You need to both add `offline_access` as a scope requested by your application AND ensure that the “Refresh Token” grant is enabled for the application you are using. See details about getting and using refresh tokens here: [Refresh access tokens | Okta Developer](https://developer.okta.com/docs/guides/refresh-tokens/main/)

However, the null pointer error you are getting sounds unrelated to a possible missing configuration in Okta.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [February 8, 2024, 9:14pm UTC](https://devforum.okta.com/t/refresh-token-coming-null/18773/5 "2024-02-08T21:14:56Z")

</div>

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