question

allan-farinas avatar image
allan-farinas asked ·

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?
topic-default
1 |1000 characters needed characters left characters exceeded

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 ·
Could you please post your code here? (remove credentials before posting)
2 comments Share
1 |1000 characters needed characters left characters exceeded

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

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 · ·
You are not taking advantage of the official RingCentral Ruby SDK. Please check it here:  https://github.com/ringcentral/ringcentral-ruby
0 Likes 0 · ·
vb avatar image
vb 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. Donot 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 drop us an email @ devsupport@ringcentral.com  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. 


Share
1 |1000 characters needed characters left characters exceeded

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

Anirban Sen Chowdhary avatar image
Anirban Sen Chowdhary 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

Share
1 |1000 characters needed characters left characters exceeded

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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