News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
Why am I getting 'OAU-213: Token Not Found' when refresh token has not expired?
Tags: authentication
Apr 20, 2017 at 8:10pm   •   5 replies  •  0 likes
grant-botma

We built an application that syncs with clients' CRMs and sends automated text messages from their sales campaigns. New clients are asked to log in and obtain an OAuth Token via Authorization Code Flow. We have a scheduled task that sends an automated text message for any user whose refresh token will expire within two days in order to ensure that users don't have to log in once a week and obtain a new token. This works most of the time, but every so often one of the tokens that we have cached and encrypted fails to refresh when we send the automated text that is supposed to obtain a new token. The error we've been getting for these instances has been an 'OAU-213: Token Not Found'.


Can you provide any insight as to why this might be happening? The most recent instance of this occurred this evening (Thursday) for a user whose refresh token isn't set to expire until Saturday.

5 Answers
answered on Jun 19, 2019 at 10:52pm  

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


 0
answered on Sep 15, 2017 at 2:39pm  
Thank you Tyler.  Reason 1 was exactly the issue we were having.

 0
answered on Apr 20, 2017 at 11:01pm  

OK, there are 3 possible reasons:

1. Each user could have no more than 5 active tokens. If a user login 6 times in different processes, the first login token will be invalidated.

2. Token could be saved into the database and shared among processes. A token was refreshed somewhere (maybe in another process) but you forgot to save the new token. Old token was expired immediately after the refresh.

3. There is a bug on the RingCentral API Server side.

If you believe #3 is the root cause, please send the exception together with timestamp and stacktrace to the developer support team on a support ticket.


 1
on Jul 27, 2022 at 2:37pm   •  0 likes

Sorry to dig up an old thread, but is there any way of getting a notification/alert/webhook if the 1st scenario happens?

I'm having a similar experience as described, and I'm positive it's not #2, since it's all taken care of well with locks/mutex.

But since it's customers connecting their RingCentral account to my service, I have no way of knowing or controlling how many active tokens they may or may not have for other services.

For some extra context, I've been looking at my logs, and it just seems completely random that the tokens vanished. The tokens hadn't just been refreshed (chance of a race condition or having been updated), the access token started failing, and the refreshing is also failing now.

Thanks!

on Jul 28, 2022 at 3:02am   •  0 likes

I've just had this happen on the 3rd account in the last 15 hours, after it not happening in a long time.

on Jul 29, 2022 at 7:43am   •  0 likes

This is less common and could be because of your way of handling access token or just a particular case on an extension/account. I recommend you for such a scenario, open a support ticket and give more details about the background, app info and the account info so they can help to track it down.

answered on Apr 20, 2017 at 10:30pm  
Which programming language are you using?
Ruby, RoR app using the unofficial Ring Central Ruby SDK: https://github.com/ringcentral-ruby/ringcentral-sdk-ruby

Which API endpoint are you invoking in order to refresh the token?
SMS message endpoint. From what I can tell, the Ruby SDK doesn't have a method that explicitly performs a token refresh. The Faraday client that the Ruby SDK uses automatically refreshes the token when a message is sent, so we have a rake task scheduled that sends out an automated text message when a user's refresh token is about to expire in order to obtain a new token. 

The user for whom the 'OAU-213: Token Not Found' error occurred when this automated text was being sent out. I pulled the data for his OAuth 2 token, and the refresh token is not set to expire until Saturday, so I'm confused as to why we're getting this error. Does this make sense?


 0
answered on Apr 20, 2017 at 10:12pm  
We have a scheduled task that sends an automated text message for any user whose refresh token will expire within two days in order to ensure that users don't have to log in once a week and obtain a new token.
Could you please elaborate?  Which programming language are you using? Which API endpoint are you invoking in order to refresh the token?  I feel confused by "sends an automated text message  ... to obtain a new token"

 0



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us