question

taybr9915061 avatar image
taybr9915061 asked Phong Vu commented

Authorization code flow for Multiple extension(users)

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

ringcentral appcall monitoring
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image
Phong Vu answered

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.

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

taybr9915061 avatar image
taybr9915061 answered

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

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image
Phong Vu answered

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.

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

taybr9915061 avatar image
taybr9915061 answered Phong Vu commented

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

11 comments
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image Phong Vu ♦♦ commented ·

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

1 Like 1 ·
taybr9915061 avatar image taybr9915061 Phong Vu ♦♦ commented ·

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

0 Likes 0 ·
taybr9915061 avatar image taybr9915061 taybr9915061 commented ·

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.

0 Likes 0 ·
Show more comments
taybr9915061 avatar image
taybr9915061 answered Phong Vu commented

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

4 comments
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

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.

0 Likes 0 ·
taybr9915061 avatar image taybr9915061 Phong Vu ♦♦ commented ·

Hi Phong Vu,

Why I am not able to send message here?

Thanks

0 Likes 0 ·
taybr9915061 avatar image taybr9915061 Phong Vu ♦♦ commented ·

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

0 Likes 0 ·
Phong Vu avatar image Phong Vu ♦♦ taybr9915061 commented ·

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.

--

0 Likes 0 ·

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys