# Can't revoke accessToken

**URL:** <https://devforum.okta.com/t/cant-revoke-accesstoken/1785>\
**Category:** OAuth/OIDC\
**Tags:** ios\
**Created:** [May 14, 2018, 8:20pm UTC](https://devforum.okta.com/t/cant-revoke-accesstoken/1785 "2018-05-14T20:20:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![berty](https://avatars.discourse-cdn.com/v4/letter/b/e36b37/32.png) [@berty](https://devforum.okta.com/u/berty)\
**Post date:** [May 14, 2018, 8:20pm UTC](https://devforum.okta.com/t/cant-revoke-accesstoken/1785/1 "2018-05-14T20:20:56Z")

</div>

Hi everyone,

I’m trying to figure out the `revoke()` method is working but after several attempts, it seems like my tokens aren’t revoked at all. The tokens variables still contain a String value.

BUT, if I call the `clear()` method, all of the tokens are set to nil.

Is there’s something I’m missing? Is it a bug?

Thanks for your help!

* * *

Platform: iOS 11.0 | Xcode 9.3.1 | Swift 4.1

---

<div class="post-metadata">

**Author:** ![jmelberg](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/jmelberg/32/154_2.png) [@jmelberg](https://devforum.okta.com/u/jmelberg)\
**Post date:** [May 15, 2018, 4:03pm UTC](https://devforum.okta.com/t/cant-revoke-accesstoken/1785/2 "2018-05-15T16:03:07Z")

</div>

Hey @berty,

I’m assuming you’re using [Okta’s iOS AppAuth Wrapper Library](https://github.com/okta/okta-sdk-appauth-ios).

The `OktaAuth.revoke()` method takes an `accessToken` or `refreshToken` and passes it to Okta’s [`/revoke`](https://developer.okta.com/docs/api/resources/oidc#revoke) endpoint. Any following [**introspection**](https://developer.okta.com/docs/api/resources/oidc#introspect) or [**userinfo**](https://developer.okta.com/docs/api/resources/oidc#userinfo) request will return an unauthorized status, as the User no longer has a valid token.

We made the decision to **not** clear the token from storage once it is revoked, as a more meaningful error message is visible to the developer and/or end user. Could this be why it appears to **not** be working?

In practice, it is good to revoke the `accessToken` and `refreshToken` before terminating the User’s session. So you’re certainly taking the correct steps!

---

<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, 11:07pm UTC](https://devforum.okta.com/t/cant-revoke-accesstoken/1785/3 "2024-01-12T23:07:04Z")

</div>

Closed on January 12, 2024, 11:07pm UTC

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