News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
Making API Ringout calls using different users
Tags: ringout
Dec 7, 2023 at 11:44am   •   3 replies  •  0 likes
Anish Rege

We have an app in Production mode which uses MakeACall endpoint to make RingOut calls. Currently we are using the JWT auth flow. What's happening is all the calls which are going out are through the JWT user who created the app, and we are getting a message "Request rate exceeded" . What we want to do instead is, calls should happen based on the user who is trying to make the call and not based on the user who create the App. We are not sure how to do that and create users for each of the "from" caller. Is there a way to achieve this?


we tried using ringout url with extId as follows but it didnt help:
https://platform.ringcentral.com/restapi/v1.0/account/~/extension/{extId}/ring-out

Also, if there is any other solution you recommend instead of ours, we would like to know.


3 Answers
answered on Dec 14, 2023 at 4:36pm  

Ok, I tried the authorization code flow (Authorization code flow (ringcentral.com) and the callback successfully happens to the redirect_uri mentioned below after sign in on the ringCentral portal

https://platform.ringcentral.com/restapi/oauth/authorize?response_type=code&redirect_uri=http://localhost:53891/api/RingCentral/GetRingCentralCallback&prompt=login&client_id={clientId}&state=Create


Once we get the code at the callback url mentioned above, when we post to /restapi/oauth/token with post data, it seems to fail with the following response:

{ "error" : "invalid_client", "errors" : [ { "errorCode" : "OAU-153", "message" : "Invalid client: {clienId}", "parameters" : [ { "parameterName" : "client_id", "parameterValue" : "{clientId}" } ] } ], "error_description" : "Invalid client: {clientId}" }

I am using the same ClientId which is been passed to /restapi/oauth/authorize endpoint.


Below is the C# code for retrieving the token

string postData = "grant_type=authorization_code&code=" + code + "&client_id=" + rcOAuthClientId;

var rcAuthKey = CommanFunction.StrEncrypt(rcOAuthClientId + ":" + rcOAuthClientSecret);

var header = new WebHeaderCollection();

header.Add("Authorization", $"Basic {rcAuthKey}");

header.Add("ContentType", "application/x-www-form-urlencoded");

var result = HttpReqCall.Request(WebRequestMethods.Http.Post, rcAuthUrl, postData, header, "application/x-www-form-urlencoded");


Is this anything wrong which i am doing?









 0
answered on Dec 11, 2023 at 9:52am  

It would be helpful if you could provide us a working example(maybe a github link to project) for "Implementing 3-legged authorization". That would be much helpful in addition to api docs.


 0
on Dec 11, 2023 at 10:28am   •  0 likes
on Dec 11, 2023 at 10:43am   •  0 likes

Thank you, for the 1st implementation you recommended to get JWT for each user, I believe we have to do a username/password based auth to get the token for the respective user?

on Dec 11, 2023 at 1:04pm   •  0 likes

No, password flow is deprecated and we will only support JWT. For JWT, there is no API to generate a JWT token for a user. So each user must login their RingCentral developer portal to create its own JWT and provide you with the JWT token. Or it's up to you how you will get the JWT token from your users. Once you have their JWT token, you use it to exchange for the access token to call APIs.

answered on Dec 7, 2023 at 3:31pm  

There are 2 options

1/ You collect the JWT of each user and when that user loads the page, use his JWT token to get the access token and make a ring-out call.

2/ Implement 3-legged authorization so that it requires a user to login with their own RingCentral username/password. Once the user logged in, you get the access token and use it to call the ring-out API.


 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

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us