Skip to main content
Question

OAuth authentication API

  • July 16, 2015
  • 10 replies
  • 4154 views

Hey, I am trying to get the access token and refresh token. I am sending the request using curl. I have followed all the steps written in API docs. The response I am getting is

{

"error" : "invalid_grant",

"error_description" : "Invalid resource owner credentials."

}


Can u tell me what's wrong with that ????


Thank You!!!

10 replies

  • New Participant
  • July 16, 2015
"invalid_grant
The provided authorization grant (e.g., authorization
code, resource owner credentials) or refresh token is
invalid, expired, revoked, does not match the redirection
URI used in the authorization request, or was issued to
another client.
" I found this document, hope it helps:

http://oauthlib.readthedocs.org/en/la...

  • July 16, 2015

This error indicates that the user credentials provided are improper, e.g. username, extension, and/or password.

Below is information on getting your proper credentials in the Sandbox Environment and Production Environment.

1) Sandbox Environment User Credentials

If you are on Sandbox Environment,  follow the below steps to get your sandbox account credentials:

  1. Login to https://developer.ringcentral.com/ using your Developer Platform credentials (RC account credentials)
  2. Go to your Sandbox Account page: "My Account > Sandbox Account". Locate the "Main Company Number" which will be your username when formatted in E.164 format, (example: +12223334444).  
  3. The password is the password you received via email when you created the sandbox account, unless you have changed the password.
The above credentials can also be used for logging into, and reset at, the Online Account Portal for Sandbox Environment at: https://service.devtest.ringcentral.com/

In addition to your user credentials, you need to ensure you are connecting to the correct Sandbox API end point and using the correct application credentials described below:
  1. For sandbox environment, the API sever end endpoint URI is  https://platform.devtest.ringcentral.com 
  2. Find your application key and secret by clicking on My Account -> Applications -> Application Name. Use Sandbox Application key and secrets

The easiest way to start testing our APIs would be by using our  API Explore here  http://ringcentral.github.io/api-explorer/. You can start filling out your RC sandbox credentials and start going from there. We have self explanatory documentation in the link above.

2) Production Environment

If you are on Production Environment, follow the below steps to get your production account credentials:

  1. The user credentials for production are the same ones as for your RingCentral phone account that you use, e.g. to log into the Online Account Portal at https://service.ringcentral.com.
In addition to your user credentials, you need to ensure you are connecting to the correct Production API end point and using the correct application credentials described below:
  1. For production environment, the sever end endpoint uri is  https://platform.ringcentral.com 
  2. Find your application key and secret by clicking on My Account -> Applications -> Application Name. Use Production Application key and secrets

For more information please visit this link: https://developer.ringcentral.com/library/tutorials/test-account.html


  • August 2, 2015
Hey VB,

Thanks for the reply. I have got the acces token. Now, I am trying to make a ringout call using the ringcentral API. The request body I am passing is like this :

{  "to": {"phoneNumber": "91*******"},
  "from": {"phoneNumber": "91*******"},
  "callerId": {"phoneNumber": "91*******"},
  "playPrompt": true
}

The response I am getting is : 

{ "message": "Forbidden", "errorCode": "InternationalProhibited" }

The same call when I try to make with the ringcentral account is successful. Can u tell me what's wrong with that. 

International calling is not supported in the Sandbox. Please use US local numbers or numbers on your test account to place calls to verify your code. This will work as expected in Production provided the accounts you use there have the right privileges and credits to make international calls.

  • New Participant
  • February 16, 2017
Hi - i do provide all the correct information, but still get this error. what could i possibly be doing wrong? this is a sandbox account


  • New Participant
  • February 16, 2017
On top of that, i am unable to login with my 'main' account number auto-generated when i opened up a sandbox account.

https://service.devtest.ringcentral.com/#/number

but it works with the email option

  • New Participant
  • February 16, 2017
It stops working the moment i switch the app type to 'server only'

  • February 21, 2017

Can you send us an email or open a support ticket?


  • New Participant
  • August 31, 2017
Hello,

I want to use Ringcentral Ringout call in my app. I follow https://developer.ringcentral.com/api-explorer/latest/index.html#/RingOut 

But, I am unable to login through CURL. Please assist how can I login through CURL




  • Known Participant
  • August 31, 2017
Hi Sushil,

Before you login, could you please check if the Application type = Private and Platform Type = Server-only ( NO UI ). 

As all other application types would need Authorization Code Flow or commonly known as OAuth2.0 as the authentication flow. However, if your application is of the above mentioned type then you can use the Password Flow as the authentication flow.

However, I would recommend you take a look at our dev community article below on how to login ( get tokens ) through cURL:
https://devcommunity.ringcentral.com/ringcentraldev/topics/curl-command-for-requesting-access-token