Kenny FONG avatar image
Kenny FONG asked Tyler Liu answered

Intermittent error OAU-213 Token not Found error when refreshing using .Net library


I am using the .Net library as I am getting an intermittent error when using the await rc.Refresh() method where rc is RestClient. I call the refresh method before the token has expired.

The response I get when it has errored is:

StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
  Connection: keep-alive
  X-Application-Context: application:8080
  RCRequestId: ba572a7c-357f-11eb-b754-005056b58a26
  Pragma: no-cache
  AceRoutingKey: ams01-c01-ace02.75bacc1c-0756-11eb-a2dd-005056b5fcaa
  RoutingKey: ZRH01P32
  Cache-Control: no-store
  Date: Thu, 03 Dec 2020 15:53:46 GMT
  Server: nginx
  Content-Length: 161
  Content-Language: en
  Content-Type: application/json; charset=utf-8
Content: {
  "error" : "invalid_grant",
  "errors" : [ {
    "errorCode" : "OAU-213",
    "message" : "Token not found"
  } ],
  "error_description" : "Token not found"

I am wondering if you can help? This doesn't happen all the time and generally the token refresh is done every 59 minutes

1 |3000

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

1 Answer

Tyler Liu avatar image
Tyler Liu answered

What is your SDK version?

Instead of refresh 59 minutes, refresh every 30 minutes.

There is a 5-active-tokens limit. So if you are requesting tokens too frequently, old ones will be invalidated, thus "not found".

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