# Unable to retrieve refresh\_token

**URL:** <https://devforum.okta.com/t/unable-to-retrieve-refresh-token/307>\
**Category:** OAuth/OIDC\
**Created:** [August 3, 2017, 10:34am UTC](https://devforum.okta.com/t/unable-to-retrieve-refresh-token/307 "2017-08-03T10:34:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![damomurf](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/damomurf/32/84_2.png) [@damomurf](https://devforum.okta.com/u/damomurf)\
**Post date:** [August 3, 2017, 10:34am UTC](https://devforum.okta.com/t/unable-to-retrieve-refresh-token/307/1 "2017-08-03T10:34:52Z")

</div>

I’m trying to obtain access\_token, id\_token and refresh\_token to use with Kubernetes kubectl authentication as per their documentation at: [Authenticating | Kubernetes](https://kubernetes.io/docs/admin/authentication/#openid-connect-tokens)

I’ve been down the pure API path via shell scripts and now the Javascript widget and don’t seem to ever be able to get all three token values, only ever id\_token and access\_token. I’ve tried the three separate app type of Web, Native and SPA but all have the same issue. The current Javascript code I have is as follows. It happily logs in and dumps use access\_token and id\_token to the JS console. What am I doing incorrectly here?

```auto
var oktaSignIn = new OktaSignIn({
	baseUrl: "...",
	clientId: '...',
	redirectUri: '...',
	authParams: {
		responseMode: 'form_post',
        responseType: ['token', 'id_token'],
		scopes: [
            'openid',
            'offline_access'
		]
	}
});

oktaSignIn.renderEl(
  { el: '#okta-login-container' },
  function (res) {
    if (res.status === 'SUCCESS') {
        
    	console.log('res<%o>', res);
    }
  }
)

```

The app is configured in Okta as follows:

![AA3C3968-BCA2-4E23-8EF8-BF82C9EB982B](https://global.discourse-cdn.com/oktadev/original/1X/d93614b8ad8fce7c86c9c45728eb67a7b4a21b2c.png)

---

<div class="post-metadata">

**Author:** ![tom](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/tom/32/24_2.png) [@tom](https://devforum.okta.com/u/tom)\
**Post date:** [August 3, 2017, 4:55pm UTC](https://devforum.okta.com/t/unable-to-retrieve-refresh-token/307/2 "2017-08-03T16:55:25Z")

</div>

Quick look at it, I’m pretty sure it is because you are asking for tokens, and to get the refresh\_token you need to use the /tokens endpoint AND the code flow.

Since Okta is OIDC compliant, the Authorization server must ignore offline\_access if the response type is not code.

---

<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:** [January 12, 2024, 7:13pm UTC](https://devforum.okta.com/t/unable-to-retrieve-refresh-token/307/3 "2024-01-12T19:13:33Z")

</div>

Closed on January 12, 2024, 7:13pm UTC

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