# oktaAuth.signOut & id\_token\_hint

**URL:** <https://devforum.okta.com/t/oktaauth-signout-id-token-hint/16229>\
**Category:** Questions\
**Created:** [September 20, 2021, 2:28pm UTC](https://devforum.okta.com/t/oktaauth-signout-id-token-hint/16229 "2021-09-20T14:28:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![subs](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/subs/32/2991_2.png) [@subs](https://devforum.okta.com/u/subs)\
**Post date:** [September 20, 2021, 2:28pm UTC](https://devforum.okta.com/t/oktaauth-signout-id-token-hint/16229/1 "2021-09-20T14:28:57Z")

</div>

Hello,

I am using, @okta/okta-react, and trying to sign somebody out of the react application and Okta.

When I call the signOut() it redirects me to an error page, see below. If I then refresh the page, I get another error saying that the `id_token_hint` is undefined. Is the value of `id_token_hint` supposed to be the token?

How do I get around the error and make sure `id_token_hint` is not null?

```auto
const logout = async () => {
		/* await oktaAuth.revokeAccessToken(); */ 
		await oktaAuth.signOut({
			id_token_hint: token,
			idToken: token,
			postLogoutRedirectUri: `${process.env.REACT_APP_BASE_PATH}/`,
			client_id: `${process.env.REACT_APP_CLIENT_ID}`,
		});
	}

```

 ![image](https://global.discourse-cdn.com/oktadev/original/2X/4/484b4b577449f5cb0852eb7195e353041654483a.png)

---

<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:** [September 20, 2021, 3:09pm UTC](https://devforum.okta.com/t/oktaauth-signout-id-token-hint/16229/2 "2021-09-20T15:09:14Z")

</div>

Yes, the value for id\_token\_hint is the raw JWT string ID token. If you are using OWIN directly, I’ve seen something like this happen before, where the id token is not available during logout due to it having expired, so you may need to manually fetch the id\_token and make your own request to the /logout endpoint.

---

<div class="post-metadata">

**Author:** ![subs](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/subs/32/2991_2.png) [@subs](https://devforum.okta.com/u/subs)\
**Post date:** [September 20, 2021, 3:17pm UTC](https://devforum.okta.com/t/oktaauth-signout-id-token-hint/16229/3 "2021-09-20T15:17:02Z")

</div>

Thanks for replying Andrea.

I am trying to logout using the /logout endpoint and it isn’t redirecting to the `post_logout_redirect_uri` it just takes me to the Okta Login page.

[https://mycompany.okta.com/oauth2/v1/logout?id\_token\_hint=[token]&post\_logout\_redirect\_uri=http://localhost:3000/](https://mycompany.okta.com/oauth2/v1/logout?id_token_hint=%5Btoken%5D&post_logout_redirect_uri=http://localhost:3000/)

`http://localhost:3000/` is listed under Sign-out Redirect URIs in Okta Admin.

---

<div class="post-metadata">

**Author:** ![subs](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/subs/32/2991_2.png) [@subs](https://devforum.okta.com/u/subs)\
**Post date:** [September 20, 2021, 8:01pm UTC](https://devforum.okta.com/t/oktaauth-signout-id-token-hint/16229/4 "2021-09-20T20:01:49Z")

</div>

Just to close the loop/thread. I got it working and this is what my logout function looks like now. The issues seemed to be that the oktaAuth.isAuthenticated was remaining true until I called `closeSession()`

```auto
	const logout = async () => {
		oktaAuth.tokenManager.remove(oktaAuth.getAccessToken());
		oktaAuth.closeSession()
			.then(() => {
				//window.location.reload(); // optional
			})
			.catch(e => {
				if (e.xhr && e.xhr.status === 429) {
					// Too many requests
				}
		})
		window.location.href = `${process.env.REACT_APP_ISSUER}oauth2/v1/logout?id_token_hint=${token}&post_logout_redirect_uri=${process.env.REACT_APP_BASE_PATH}`
	};

```

---

<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:** [September 21, 2021, 8:02pm UTC](https://devforum.okta.com/t/oktaauth-signout-id-token-hint/16229/5 "2021-09-21T20:02:15Z")

</div>

Closed on September 21, 2021, 8:02pm UTC

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