# Refresh token is null when accessed through springboot OAuth2AuthorizedClient class

**URL:** <https://devforum.okta.com/t/refresh-token-is-null-when-accessed-through-springboot-oauth2authorizedclient-class/22240>\
**Category:** OAuth/OIDC\
**Created:** [October 25, 2022, 12:58am UTC](https://devforum.okta.com/t/refresh-token-is-null-when-accessed-through-springboot-oauth2authorizedclient-class/22240 "2022-10-25T00:58:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nitinram](https://avatars.discourse-cdn.com/v4/letter/n/90ced4/32.png) [@nitinram](https://devforum.okta.com/u/nitinram)\
**Post date:** [October 25, 2022, 12:58am UTC](https://devforum.okta.com/t/refresh-token-is-null-when-accessed-through-springboot-oauth2authorizedclient-class/22240/1 "2022-10-25T00:58:27Z")

</div>

I have the following setup in okta

 ![Screen Shot 2022-10-24 at 5.57.11 PM](https://global.discourse-cdn.com/oktadev/original/2X/9/98ac96c25f085a44cf2615cbeacf3f7c203b9ee6.jpeg)

I am able to access the accessToken through the OAuth2AuthorizedClient.getAccessToken() method successfully but the OAuth2AuthorizedClient.getRefreshToken() always returns null value. Any idea on how i can resolve this?

---

<div class="post-metadata">

**Author:** ![erik](https://avatars.discourse-cdn.com/v4/letter/e/b5ac83/32.png) [@erik](https://devforum.okta.com/u/erik)\
**Post date:** [October 30, 2022, 11:18pm UTC](https://devforum.okta.com/t/refresh-token-is-null-when-accessed-through-springboot-oauth2authorizedclient-class/22240/2 "2022-10-30T23:18:50Z")

</div>

Hello,  
Is your application requesting the `offline_access` scope when it authorizes into Okta in order to get a refresh\_token?

---

<div class="post-metadata">

**Author:** ![nitinram](https://avatars.discourse-cdn.com/v4/letter/n/90ced4/32.png) [@nitinram](https://devforum.okta.com/u/nitinram)\
**Post date:** [November 10, 2022, 2:11pm UTC](https://devforum.okta.com/t/refresh-token-is-null-when-accessed-through-springboot-oauth2authorizedclient-class/22240/3 "2022-11-10T14:11:15Z")

</div>

I was able to get it by setting offline\_access scope!

---

<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:** [November 11, 2022, 2:11pm UTC](https://devforum.okta.com/t/refresh-token-is-null-when-accessed-through-springboot-oauth2authorizedclient-class/22240/4 "2022-11-11T14:11:59Z")

</div>

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