Sandbox Environment api not working

  • 1
  • Question
  • Updated 2 years ago
Hi All,

We have created one application in sandbox environment but facing an issue during account linking for authorization process. We have also tried with native API as well as CTI demo app but its not working. Please suggest how to process for the same:

Issue:
  • CTI Demo App issue: Its showing refresh token issue during account linking.
  • Sandbox Native API : Its showing invalid garnt type error.
Thanks for the advance. It would be great if you can share any thought for the same.

Thanks,
Yash
Photo of Yash Pal

Yash Pal

  • 90 Points 75 badge 2x thumb

Posted 2 years ago

  • 1
Photo of Benjamin Dean

Benjamin Dean, Alum

  • 8,642 Points 5k badge 2x thumb
Are you using Authorization Flow (GET /restapi/oauth/authorize) or Credentials Flow (POST /restapi/oauth/token)?

Are you using one of our SDKs? If you are, which one please?

Could you provide the full request/response (with headers minus API keys) please?
Photo of Yash Pal

Yash Pal

  • 90 Points 75 badge 2x thumb
I am using this flow : GET /restapi/oauth/authorize

I want to use CTI demo application so could you please suggest the steps for the same.
Photo of Yash Pal

Yash Pal

  • 90 Points 75 badge 2x thumb
After creating the access token m hitting to generate access token as per below:

POST /restapi/oauth/token HTTP/1.1Host: platform.devtest.ringcentral.com
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Cache-Control: no-cache
Postman-Token: 53d0830e-4048-f490-d86d-66136ebc5001

----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="grant_type"

authorization_code
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="code"

U0pDMTFQMDFQQVMwMXxBQUFGSkgzVlFvakpaeXprUkY4SDlYZ2UzOWZvNmE0Mzc2MWpkVldpSVdobHZSYmxLaHcxNl9mbDZBWEJUUFBjUjRnOEVhRHNxRWdJVUNYQjd4dmJsWHJod0t3aXNUSjR6WG1FNU9pNzNaendSZ2NLT2pmQzJDVGVrZTBGaEVGeDJVZ3xaQk9JTXd8U2g2NlhzR3VOR3N0NEpKTFZXU2c5UQ
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="redirect_uri"

https://ringcentral.github.io/cti-demo/
----WebKitFormBoundary7MA4YWxkTrZu0gW
Photo of John Wang

John Wang, Official Rep

  • 5,476 Points 5k badge 2x thumb
(1) Invalid Grant Type Error

The CTI Demo uses 3-legged OAuth with the Authorization Code grant type so your app must have the Authorization Code grant enabled in the Developer Portal for your app (https://developers.ringcentral.com).

(2) Redirect URI

The redirect URI for the CTI demo on the GitHub pages account is:

https://ringcentral.github.io/cti-demo/oauth.html

If you are installing the demo from the GitHub repo (https://github.com/ringcentral/ringcentral-cti-demo-js) to run / edit locally, you'll need to have your own redirect URI.

For example, if you run the site as http://localhost:8080 then your redirect URI would be:

http://localhost:8080/oauth.html

For CTI demo issues, you can also open issues on the GitHub repo:

https://github.com/ringcentral/ringcentral-cti-demo-js/issues

For additional resources, see the OAuth 2.0 link provided by VB below.
(Edited)
Photo of VB

VB, Official Rep

  • 1,470 Points 1k badge 2x thumb
Hi Yash ,

I am guessing the application you are building is for web use case. Please follow the instructions in the link https://devcommunity.ringcentral.com/ringcentraldev/topics/using-oauth-2-0-authorization-code-grant-... . For web use case we would suggest you to use 3 legged Auth flow . There are few sample application demos which will help you resolve the above issue.