question

yash-pal1841 avatar image
yash-pal1841 asked ·

Sandbox Environment api not working

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

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

benjamin-dean avatar image
benjamin-dean answered ·
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?
3 comments 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.

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.

0 Likes 0 · ·
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
0 Likes 0 · ·
(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.
0 Likes 0 · ·
vb avatar image
vb answered ·
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. 
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.