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
Authorization code flow for Multiple extension(users)
Tags: ringcentral app, call monitoring
Feb 17, 2024 at 12:45am   •   5 replies  •  0 likes
taybr

Hello, I am upgrading Ring-central api password flow to Authorization code flow, I have multiple extension where I were used password flow to get the call records , sending sms etc. but now I have to upgrade with Outh flow. So My question is how do I use Rincentral api use for multiple extension in on loop code? I know there is access tokent that needs to be refresh every hour to keep live but how do I manager for multiple extension in looping?


Thanks

5 Answers
answered on Apr 24, 2024 at 1:00am  

Hi Phong Vu,

When I was using user name and password for auth process, I was seen the call log record properly but now using JWT token call log record not see properly, is something changed with JWT token for call log records?

I am using the below script to get the call records

$queryParams = array(
'view' => 'Detailed',
'dateFrom' => $final_date,
'page' => 1,
'perPage' => 1000,
);

var_dump($queryParams);

$rcsdk = new RingCentral\SDK\SDK($RINGCENTRAL_CLIENTID, $RINGCENTRAL_CLIENTSECRET, $RINGCENTRAL_SERVER);
$platform = $rcsdk->platform();
$platform->login( [ "jwt" => $jwt ] );
$r = $platform->get("/restapi/v1.0/account/~/extension/~/call-log", $queryParams);
$ring_array = json_decode($r->text(), true);


Second thing: VM/Abandoned call results not getting in web hook subscription, is it any special event filter for that?

I can see the log of VM/Missed but not the VM/Abandoned call. What is the difference between of both of?

Thanks


 0
on Apr 24, 2024 at 8:16am   •  0 likes

There must be no difference API result between using either password flow or JWT flow auth. You must make sure that it is the same user extension who logged in the app before and who generated the JWT token now.

Telephony session event notification gives you the raw data. "Abandoned" is an interpretation and it's not a raw call result from the notification event.

For the call log result, I don't think that it gives the "Abandoned" call result either (even the API documentation lists the "Abandoned" term as one of the possible results). Instead, the result can be either Missed or Voicemail, where missed calls can be interpreted directly as abandoned calls, but voicemails are not.

In live report and analytics report, abandoned calls may also be interpreted differently. When a call is routed to a voicemail, the caller may hangup w/o leaving a voice message, that can be interpreted as an abandoned call.

on Apr 26, 2024 at 6:32am   •  0 likes

Hi Phong Vu,

Thank you for your reply.

My issue attached as screenshot, why I am not able to get "VM/Abandoned" call records from api.

https://www.awesomescreenshot.com/image/47727420?key=bef1a42732fb1bc2f4daa54f9d11229b

on Apr 26, 2024 at 7:07am   •  0 likes

I wrote you earlier, the interpretation is done by an app that process the data. The call log does not give the abandoned result.

--

In live report and analytics report, abandoned calls may also be interpreted differently. When a call is routed to a voicemail, the caller may hangup w/o leaving a voice message, that can be interpreted as an abandoned call.

--

on Apr 26, 2024 at 6:28am   •  0 likes

Hi Phong Vu,

Why I am not able to send message here?

Thanks

answered on Feb 25, 2024 at 9:31pm  

Hi Phong Vu,


Thank you so much for your help. Is it possible to have both authentication method for an app until I updated password flow to JWT Auth? Because I need to check the working on production mode and there is an radio option to change the method. If both methods enable for an app, I can check working without any issue.


Thanks


 0
on Feb 26, 2024 at 7:18am   •  1 likes

Yes, that is possible. Give me the app client id.

on Feb 26, 2024 at 8:57am   •  0 likes

Hi Phong Vu,

If both are enabled, I'm afraid won't there be any problem?

Where can I share client id? Can I share here?

Thanks

on Feb 26, 2024 at 9:17am   •  0 likes

Actually there are lot's off cron job run at production mode with old ring-central API with php 5.6 and you know JWT will work for new update Library of ring-central which is for php 7.2 above.


So I am afraid If both oauth enable for the app, may be have an issue for old ring-central API.

on Feb 27, 2024 at 11:52pm   •  0 likes

Hi Phong Vu,

Thank you for your help. I have passed client id to Ring-central support via email and both auth are enabled.


I have small issue now, When I used /restapi/v1.0/account/~/extension/~/active-calls scope for JWT token , getting error message as following

"

Refresh token has expired

"

Is somthing wrong ?

Thanks


on Feb 28, 2024 at 7:10am   •  0 likes

Show me how do you use the JWT token (mask or cut the real token short).

JWT token is not an access token, nor the refresh token. You use the JWT token to get an access token and a refresh token. If you do it right and the refresh token expired, then simply use the JWT token again to get the tokens.

on Mar 6, 2024 at 1:21am   •  0 likes

Hi Phong,

Thank you! I have last question about it.


I have setup one app that's working for web-hook subscription, do I need also create again subscription for the users (life long validity ) or need to change just oauth type password flow to JWT from ring-central app settings?


Thanks

on Mar 6, 2024 at 7:15am   •  0 likes

You need to change it to JWT flow. Because there is no guarantee that your webhook subscription would run for the entire specified time if it is blacklisted/suspended for any reason. In that case, you have to subscribe for the notification again, thus, you will need a JWT token to authenticate your app.

on Feb 26, 2024 at 10:10am   •  0 likes

Enable both JWT and password flow will be safe to authenticate the app with either username and password or with the JWT token. This will be ok until we completely March 31st.

To be able to authenticate a user with its JWT token using the PHP SDK, you will need to upgrade the SDK to the latest version. The new SDK still supports password flow though but it will give you a warning message.

And yes, it's safe to post your app client id (client id) here.

on Mar 5, 2024 at 7:34am   •  0 likes

Hi Phong,

I have the same need while I migrate from password flow to JWT flow. Would you be so kind to VERY CAREFULLY enable BOTH password and JWT auth for app with client id 7BpWtz03RYqzkURmUh4fOQ ?

This is a business critical app, so I'm very nervous about the change, but I think this is what has to be done. I will move everyone off password by March 31.

Thanks!
Patrick

on Mar 5, 2024 at 8:27am   •  0 likes

Enabled for both auth flows. You are set to authenticate your app with JWT token or username/password. Remember that if you authenticate the same user for the same app but running in a different process, the access token in one of the app could be revoked if the number of max access token (5) is reached.

on Mar 5, 2024 at 8:43am   •  0 likes

THANK YOU! It works!!

answered on Feb 19, 2024 at 8:36am  

A JWT token can be bound to a single app (provided the app client id) or can be bound to any app under the same account. The JWT token generator shows you the options to choose.

A JWT token generated by a user will represent that user (extension). If it is bound to an app defined by the app client id, it can be used to authenticate the user only for that app. If it is bound the all apps under the account, it can be used to authenticate the user for all apps under the account.

I don't know well about your app. But if it was intended to use the password flow, then now it is best to migrate to JWT flow. Simple as each user to generate their JWT token and pass the JWT token to the app (or to you) instead of the username/password.


 0
answered on Feb 18, 2024 at 9:00am  

Hi Phong Vu,

Thank you for you reply

If I correct JWT flow is generated for only one app not for different extension. It's not per extension.

If we can then Can you please some info about how I can genrate JWT per user


Second thins ,Can I use password flow after 31 march?, because We have not front-end usera, we just have managers to see the call records and send the sms through Ring central.


Thanks


 0
answered on Feb 17, 2024 at 12:24pm  

I think you should choose the JWT flow instead of the code flow because that is kind of an equivalent method to the password flow. You will need to give the users your app client id and ask them to login the RingCentral developer portal to generate their own JWT token against the app. Then give you the JWT token instead of the username/password.

But if you really want to use the code flow, you have to implement the UI for your users to login and you will get the code from the redirectUrl you provided in the app settings, then use the code to exchange for the tokens. The tokens you receive will contain the access token (valid for 1 hr) and the refresh token (valid for 7 days each time it's issued). Then you can maintain the refresh token and use it to get a new access token if it's expired. Every time you get a new access token using the refresh token, you will receive a new refresh token and it will again be valid for another 7 days.


 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