question

jordan-seanor avatar image
jordan-seanor asked ·

Cannot Fetch Access Token

I have tried requesting the access token via both the Postman library found here:  https://devcommunity.ringcentral.com/ringcentraldev/topics/postman-collection
as well as via a CURL request. In each case I get a different error but still cannot generate an access token. 

I am using my Client ID and Client Secret found under the credentials area (Are these right?). 

Any who, 

CURL Request:

curl -X POST "https://platform.devtest.ringcentral.com/restapi/oauth/token"; \
-H "Accept: application/json" \
-H "Content-Type: application/x-www-form-urlencoded" \
-u "ClientKey:ClientSecret" \
-d "username=PhoneNumber&password=Password&extension=101&grant_type=password"
The error with the CURL request is I receive an error: Unsupported Grant Type - OAU-250
                
What is wrong with this call?

Via Postman I keep getting the error that the client invalid. 

Any help is appreciated. 
topic-default
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.

ak avatar image
ak answered ·
Hi Jordan,

Could you please check the application type, login to developer portal (  https://developer.ringcentral.com ) and click on the application and under settings you should see the "Platform Type". If the platform type is any one of below :
  • Browser-Based
  • Server-Web
  • Server-Only
Then you would need to follow the OAuth 2.0 Code flow for authentication. 

Please look up this discussion  https://devcommunity.ringcentral.com/ringcentraldev/topics/unauthorized-for-this-grant-type-error for more information.

Let us know if you have any question.
Share
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.

jordan-seanor avatar image
jordan-seanor answered ·
Hello to any future readers,
Thanks to the help of Anil @ RingCentral, I realized I was just making a dumb mistake by not reading documentation properly!

In the developer site there was a top level account phone number, I was trying to authenticate with this number and extension as opposed to my developer number (not this is a test account). 

I do feel the error message that was returned could be improved as it did not necessarily address the case I was running into. 

Issue is resolved however by using the right darn phone number!
Share
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.

ak avatar image
ak answered ·
@Jordan,

I agree with you on the error message that we should provide for this particular 'use case'. I will convey this to my team. Thanks for the feedback!

Happy Coding!
Share
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.

vj avatar image
vj answered ·
Hello Guys,
I am facing the same error but my username,password and extension number are correct Below are the screenshot could anyone help me out in this regard
Share
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.

vj avatar image
vj answered ·

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

vj avatar image
vj answered ·

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

harry avatar image
harry answered ·
you forgot to use an Authorization header indicated in this doc  http://ringcentral-api-docs.readthedocs.io/en/latest/oauth/#client-authentication
Share
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 Sen Chowdhary avatar image
Anirban Sen Chowdhary answered ·

First you need to go through using OAuth with Authorization code grant_Type and need to know how to put Authorization header .

Please check here:

https://developers.ringcentral.com/guide/authentication/oauth

https://developers.ringcentral.com/guide/authentication/auth-code-flow

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