API call to Authorize from Postman
Tags: authentication, rest api
Sep 24, 2018 at 8:36am • 14 replies • 0 likes
sara
Hi all, I am trying to test the API call to Authorize RingCentral from Postman and I am receiving 'Could not complete oauth login' error. Attached the screen shot of my request.
Access Token URL: https://platform.devtest.ringcentral.com/restapi/oauth/token
Thanks!
14 Answers
And you don't have to use Apex because we don't have official SDK for Apex.
You can use Javascript instead because there are ways for Apex to communicate with JavaScript. Check this video from me: https://www.youtube.com/watch?v=bf_Z391G2cw&t=1182s
RingCentral has official SDK for JS https://github.com/ringcentral/ringcentral-js
Here is a community version maintained by me: https://github.com/tylerlong/ringcentral-js-concise
You can use Javascript instead because there are ways for Apex to communicate with JavaScript. Check this video from me: https://www.youtube.com/watch?v=bf_Z391G2cw&t=1182s
RingCentral has official SDK for JS https://github.com/ringcentral/ringcentral-js
Here is a community version maintained by me: https://github.com/tylerlong/ringcentral-js-concise
1
I highly recommend you to read https://github.com/ringcentral/ringcentral-ruby/blob/master/lib/ringcentral.rb
170 line of code and covers all the things you need to know. Way more direct than trying everything with Postman.
For example: for authorization part: https://github.com/ringcentral/ringcentral-ruby/blob/master/lib/ringcentral.rb#L154-L165
Before you get the token, use back authorization, otherwise use bearer authorization.
And in order to exchange code for token: https://github.com/ringcentral/ringcentral-ruby/blob/master/lib/ringcentral.rb#L49-L54
You can see that grant_type: 'authorization_code' and client_id & client_secret are not included in post body.(they are used in Basic authorization header instead)
170 line of code and covers all the things you need to know. Way more direct than trying everything with Postman.
For example: for authorization part: https://github.com/ringcentral/ringcentral-ruby/blob/master/lib/ringcentral.rb#L154-L165
Before you get the token, use back authorization, otherwise use bearer authorization.
And in order to exchange code for token: https://github.com/ringcentral/ringcentral-ruby/blob/master/lib/ringcentral.rb#L49-L54
You can see that grant_type: 'authorization_code' and client_id & client_secret are not included in post body.(they are used in Basic authorization header instead)
0
If you want to jump to Apex sooner or later. Why not simply try some programming language instead of Postman?
As far as I can tell, Apex is similar to Java. Here is how we do the authorization in Java: https://github.com/ringcentral/ringcentral-java/blob/master/src/main/java/com/ringcentral/RestClient...
As far as I can tell, Apex is similar to Java. Here is how we do the authorization in Java: https://github.com/ringcentral/ringcentral-java/blob/master/src/main/java/com/ringcentral/RestClient...
0
Another scenario
I am trying the following method of call using Apex
'https://platform.devtest.ringcentral.com/restapi/oauth/authorize?response_type=code&client_id=<CLIENT ID>&client_secret=<SECRET> &redirect_uri=<REDIRECT URI>&state=step2'
'https://platform.devtest.ringcentral.com/restapi/oauth/token?code=<AUTHIRIZE CODE FROM THE RESPONSE>&grant_type=password&client_id=<CLIENT ID>&client_secret=<SECRET> &redirect_uri=<REDIRECT URI>'
Any thoughts?
I am trying the following method of call using Apex
- Made an Authorize call to RC
https://platform.devtest.ringcentral.com/restapi/oauth/authorize
, Authorize call was successful and returned the 'code: XXXXXXXX' with response - Used the Code: XXXXXXX with params to make a token call
https://platform.devtest.ringcentral.com/restapi/oauth/
token but getting 400 error.
'https://platform.devtest.ringcentral.com/restapi/oauth/authorize?response_type=code&client_id=<CLIENT ID>&client_secret=<SECRET> &redirect_uri=<REDIRECT URI>&state=step2'
'https://platform.devtest.ringcentral.com/restapi/oauth/token?code=<AUTHIRIZE CODE FROM THE RESPONSE>&grant_type=password&client_id=<CLIENT ID>&client_secret=<SECRET> &redirect_uri=<REDIRECT URI>'
Any thoughts?
0
I updated Postman and I am using same version. Now i am receiving the following error
I gave redirect uri as https://www.getpostman.com/oauth2/callback
Can you tell me what would be the redirect URI? I never worked on OAuth2 API call and I am really confused.
{ "error" : "invalid_grant", "error_description" : "Redirect URIs do not match", "errors" : [ { "errorCode" : "OAU-109", "message" : "Redirect URIs do not match" } ]}
I gave redirect uri as https://www.getpostman.com/oauth2/callback
Can you tell me what would be the redirect URI? I never worked on OAuth2 API call and I am really confused.
0
A new Community is coming to RingCentral!
Posts are currently read-only as we transition into our new platform.We thank you for your patience
during this downtime.
Try Workflow Builder
Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!Try RingCentral Workflow Builder