CURL command to get access token not working

  • 1
  • Question
  • Updated 1 year ago
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
Photo of Pratap S

Pratap S

  • 144 Points 100 badge 2x thumb

Posted 1 year ago

  • 1
Photo of Tyler Long

Tyler Long, Official Rep

  • 6,978 Points 5k badge 2x thumb
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.
Photo of Pratap S

Pratap S

  • 144 Points 100 badge 2x thumb
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?
(Edited)
Photo of Tyler Long

Tyler Long, Official Rep

  • 6,978 Points 5k badge 2x thumb
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.