question

allan-farinas11618 avatar image
allan-farinas11618 asked Anirban answered

Why am I getting this error: TokenInvalid: OAU-213 (Token not found)?

I have an application that downloads recordings using the ruby sdk. I am unable to download any recordings and get an error: OAU-213 (Token not found). The token should be valid since it has not expired.


Can anyone provide any insight why this might be happening?

sdk
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Tyler Liu avatar image
Tyler Liu answered Tyler Liu commented
Could you please post your code here? (remove credentials before posting)
2 comments
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

allan-farinas11618 avatar image allan-farinas11618 commented ·
I am using the password flow to authenticate. Here's the code:
# export RC_SERVER_URL=https://platform.devtest.ringcentral.com # export RC_USER_USERNAME= # export RC_USER_EXTENSION= # export RC_USER_PASSWORD=  @client = RingCentralSdk::REST::Client.new do |config|   config.load_env = true end  response_file = @client.http.get do |req|   req.url recording_url end

response_file.status returns a 401. Here is the response I'm getting back:
{   "errorCode" : "TokenInvalid",   "message" : "Token not found",   "errors" : [ {     "errorCode" : "OAU-213",     "message" : "Token not found"   } ] }
0 Likes 0 ·
Tyler Liu avatar image Tyler Liu ♦ commented ·
You are not taking advantage of the official RingCentral Ruby SDK. Please check it here:  https://github.com/ringcentral/ringcentral-ruby
0 Likes 0 ·
vyshakhbabji avatar image
vyshakhbabji Deactivated answered

This issue happens for a couple of reasons:

1. Access token might be expired or another access token would be generated before the current token is expired

2. when the credentials of the user might have changed while the access token would have been still valid

3. The token would have been corrupted


A quick fix for this issue would be to write a business logic :

1. Do not allow to make any API calls when this error is hit

2. Try to refresh the access token so you generate the new pair of the access token and refresh token

3. If the refresh token is not valid/ corrupt, allow the user to authorize once again.


If the above solution doesn't help, Feel free to contact us through a help ticket with full HTTP request and response along with the response headers and with the appID and detailed description of the problem if this issue still persists. My team will get back to you with the right reason, so you can fix your app.



1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Anirban avatar image
Anirban answered

Though all the possible reasons are give above, another condition I like to add is when a valid token is revoked using revoke API (reference) it shows the error message token not found. Since the token is already revoked, it will generate that message

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys