question

Philip Manavopoulos avatar image
Philip Manavopoulos asked Tyler Liu commented

Rate Limits have 0 remaining for newly issued access tokens?

Hi RC community,

I had a question around rate limits and issuing new access tokens.

I've recently started running in to an issue where newly issued access tokens have 0 calls remaining in the rate limits. So after someone connects the integration, if I try and make API calls, they are rate limited straight away.

As I understand, rate limits are per user per app/integration, right? So a newly issued access token for a user should definitely not be at 0 remaining calls from a rate limit perspective, right?

For a bit of extra context, when someone connects the integration, I need the user to have the permissions to get a list of all phone numbers (https://developers.ringcentral.com/api-reference/Phone-Numbers/listAccountPhoneNumbers). So I need to make that call, to validate that the user has the right permissions, before saving the credentials and enabling the integration. But when I call that for the newly issued access token, I get the following headers:

X-Rate-Limit-Group: heavy
X-Rate-Limit-Limit: 10
X-Rate-Limit-Remaining: 0
X-Rate-Limit-Window: 60
Retry-After: 60

Anyone have an ideas here?

Thanks,
Phil

rate limits
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

Suyash Joshi avatar image
Suyash Joshi answered Tyler Liu commented

Our Auth APIs are rate limited to 5 requests/min for the user of the app, see more here: https://developers.ringcentral.com/guide/basics/rate-limits . In order to reproduce your issue, can you tell me bit more about which programming language/sdk or paste relevant code snippet here and which Authentication mechanism are you using?

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.

Tom Kustura avatar image Tom Kustura commented ·

Having this same issue, but only with one user. All other users are able to obtain access tokens. The only way to obtain a new access token for this users is to perform OAuth workflow, but once that access token expires, all subsequent requests to obtain a new access token, by using the refresh token, are rejected with this message:

{ "statusCode" : 429 ,
"headers" :
{
"Date" : "Fri, 20 Oct 2023 22:08:22 GMT" ,
"Connection" : "keep-alive" ,
"Vary" : "Origin,Access-Control-Request-Method,Access-Control-Request-Headers" ,
"X-Rate-Limit-Limit" : "5" ,
"X-Rate-Limit-Window" : "60" ,
"X-Rate-Limit-Group" : "auth" ,
"Retry-After" : "60" ,
"X-Rate-Limit-Remaining" : "0" ,
"RCRequestId" : "2f127b08-6f95-11ee-a160-0050568df81f" ,
"Pragma" : "no-cache" ,
"Cache-Control" : "no-store" ,
"AceRoutingKey" : "iad41-c01-ace01-785556c5f4-h8fwn_10.120.156.134" ,
"RoutingKey" : "SJC01P03" ,
"CF-Cache-Status" : "DYNAMIC" ,
"Set-Cookie" :
"__cf_bm=VtG_aF7YwfZNyDzjWzCDQwcvI96yOJvfMa8jRUiPdLA-1697839702-0-AeTx7u/PGAdjFwFy6qW4npQj/VO9X1QXsmlijskhCqVkxB9pkIt58VY/CzgRlgG20sHRWVcl+h+ldHYHOZ6ovdQ=;
path=/;
expires=Fri, 20-Oct-23 22:38:22 GMT; domain=.platform.ringcentral.com; HttpOnly; Secure; SameSite=None"
,
"Server" : "cloudflare" ,
"CF-RAY" : "8194943ca832aa1f-DFW" ,
"Content-Type" : "application/json" ,
"Content-Length" : "161" ,
"Content-Language" : "en" },
"body" : { "errorCode" : "CMN-301" ,
"message" : "Request rate exceeded" ,
"errors" : [ {
"errorCode" : "CMN-301" ,
"message" : "Request rate exceeded"
} ] } }


Clearly we are not making too many requests to obtain a new access token because all other users (over 200 of them) work fine. Also, as soon as the access token expires, the next call to the RingCentral API will initiate a request for a new access token, which immediately fails with this error. In other words, there haven't been any requests for a new token for this user in over an hour because we are successfully sending SMS messages while the access token is active, so we are not initiating the call to Auth API for an hour for this user.

Any advice would be appreciated.

0 Likes 0 ·
Tyler Liu avatar image Tyler Liu ♦ Tom Kustura commented ·

screenshot-2023-10-31-at-40322-pm.png


I checked server side logs and in two hours from Oct 20 21:00 to 23:00, your app made 474 token requests (new token and token refresh) for that particular extension.

It is abnormal because in theory an access token expires in one hour and you only need to refresh it 1-2 times per hour.


0 Likes 0 ·

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