question

taybr9915061 avatar image
taybr9915061 asked taybr9915061 edited

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 taybr9915061 edited

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?


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.

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