where to use access_token

  • 1
  • Problem
  • Updated 1 year ago
Is there anyone who can help me in using Access_token in my PHP Web Application.
right now i am stuck on access_token and i want to test my Fax function but Using PHP SDK i am stuck on Refresh_token function it is giving error and looks like my SDK is not using Access_token....


i am getting this error
authData.php Auth exception: Refresh token has expired Exception: Unauthorized for this grant type SDK HTTP Error at https://platform.devtest.ringcentral.com/restapi/oauth/token Response text: { "error" : "unauthorized_client", "error_description" : "Unauthorized for this grant type", "errors" : [ { "errorCode" : "OAU-251", "message" : "Unauthorized for this grant type" } ] }
Photo of Tayyab Sajjad

Tayyab Sajjad

  • 364 Points 250 badge 2x thumb

Posted 1 year ago

  • 1
Photo of Paco Vu

Paco Vu

  • 426 Points 250 badge 2x thumb
Hi Tayyab,

It seems you selected the wrong Platform type (other types than the "Server-only/(No UI)" for your RingCentral app. If your Web app uses the PHP SDK to authenticate and access RingCentral APIs directly, you must select the "Server-only/(No UI)" for the Platform type.

Try to create a new app with that platform type and test again.

Kind regards,
Paco
Photo of Tayyab Sajjad

Tayyab Sajjad

  • 364 Points 250 badge 2x thumb
i have created another app with Server no UI but now i am not able to authorize it 
Photo of Tayyab Sajjad

Tayyab Sajjad

  • 364 Points 250 badge 2x thumb
Ohh I have done :)
but attachment is missing can you see
$request = $rcsdk->createMultipartBuilder()
                 ->setBody(array(
                     'to'         => array(
                         array('phoneNumber' => '12673314004'),
                     ),
                     'faxResolution' => 'High',
                 ))
                 ->add('Plain Text', 'file.txt')
                 ->add(fopen('D:/wamp/www/vendor/ringcentral/ringcentral-php/demo/file.txt', 'r'))
                 ->request('/account/~/extension/~/fax');
Photo of Tyler Long

Tyler Long, Official Rep

  • 5,260 Points 5k badge 2x thumb
There are two ways to get token:

#1 The first is to call login. It's not an option for you because your app doesn't support that grant type.


#2 The second is to get token via 3-legged oauth. If you use this way, please do not login because it doesn't make sense to login here since it's way #1. But please don't forget to restore the token saved by 3-legged oauth flow! Otherwise you got a token but didn't use it at all!

Here is a sample for you to restore a token: https://github.com/ringcentral/ringcentral-php/blob/master/demo/authData.php
Photo of Tyler Long

Tyler Long, Official Rep

  • 5,260 Points 5k badge 2x thumb
If you are done with the authorization issue. Please create a new thread to track new issues.
Photo of Tayyab Sajjad

Tayyab Sajjad

  • 364 Points 250 badge 2x thumb
sure :)
Can you help me in attachment ?
Photo of Tyler Long

Tyler Long, Official Rep

  • 5,260 Points 5k badge 2x thumb
Sure. I am here to help RingCentral API users.


But let's continue with a new thread. :)