question

pratap-s5689 avatar image
pratap-s5689 asked ·

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
General Topic
1 |1000 characters needed characters left characters exceeded

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

Tyler Liu avatar image
Tyler Liu answered ·
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.
1 |1000 characters needed characters left characters exceeded

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

pratap-s5689 avatar image
pratap-s5689 answered ·
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?
1 |1000 characters needed characters left characters exceeded

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

Tyler Liu avatar image
Tyler Liu answered ·
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.
1 |1000 characters needed characters left characters exceeded

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

Anirban avatar image
Anirban answered ·

"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.

1 |1000 characters needed characters left characters exceeded

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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