Skip to main content
The First Step
June 2, 2017
Question

CURL command to get access token not working

Hi


I am trying to get my access token using curl command. I looked at Question "https://devcommunity.ringcentral.com/ringcentraldev/topics/curl-command-for-requesting-access-token" but it is not working for me.


I am always getting : { "error" : "invalid_grant",

"error_description" : "Invalid resource owner credentials."

}


My credential are correct and also I tried with secret/access key and enoced it to base64 as well but for both the cases its throwing me the same above error.


If my credential are invalid I should not be able to login to web dashboard itself. I am bit confused here and not sure where I am going/doing wrong.


Thanks,

Pratap

    4 replies

    Employee
    June 2, 2017
    curl -i -X POST "https://platform.devtest.ringcentral.com/restapi/oauth/token";
    -H "Accept: application/json"
    -H "Content-Type: application/x-www-form-urlencoded"
    -u "appKey:appSecret"
    -d "username=username&password=password&extension=&grant_type=password"


    If it doesn't work. It's probably because your credential is wrong.

    Please note that, you cannot use a sandbox credential for production or vice versa.
    pratap-sThe First StepAuthor
    The First Step
    June 2, 2017
    Thanks it turn out to be I was using production for devtest :( . Also I want to disable expires for access_token and refresh_token. How can we achieve this? Also I was looking for CURL API commands to post messages to Glip goup chat is that possible?
    Employee
    June 3, 2017
    It's impossible to disable token expires. You can set them to the maximum expires_in value. As far as I can tell, access token expires in one hour. Refresh token lifetime is typically limited to one week. 

    It is possible to use CURL to post messages to Glip group. Please have a try and create a new ticket if you have difficulties.
    The First Step
    July 6, 2019

    "Also I want to disable expires for access_token and refresh_token. How can we achieve this? "

    In any OAuth system in the earth, there is no way to disable expires for access_token and refresh_token because that will be a security issue. You cannot use a permanent access_token and refresh_token as that contradict the idea of OAuth Security system.