Skip to main content
The First Step
December 1, 2022
Question

unable to use pwd or JWT authentication

I am not able to use JWT or "password based" authentication. I am always getting the error "unauthorized for this grant type".

17 replies

The First Step
December 1, 2022

my ClientID = kxHXJZJwRzW8W6EiwB_a5Q

The First Step
December 1, 2022

my ClientID = kxHXJZJwRzW8W6EiwB_a5Q

PhongVu
Community Manager
Community Manager
December 1, 2022

You cannot use password flow authentication for this app because you chose the JWT auth type. I enabled the password flow type for you to test.

Now you should be able to login using either JWT or username and password of user extensions under your sandbox account. Please let me know if you still cannot login with your JWT token, and if you don't want to use the password flow so I can change it back.

The First Step
December 4, 2022

I am now able to log in via pwd, which is a big step forward. Thank you!

I would however additionally like to use JWT, which still is giving me the "Unauthorized for this grant type",

My php statement reads:

$rcsdk = new RingCentralSDKSDK(_CLIENTID, _CLIENTSECRET, _SERVER);

$platform = $rcsdk->platform();

$platform->login( array( 'jwt' => _JWT));


and the error message is:


PHP Notice: Undefined index: username in /app/www/vendor/ringcentral/ringcentral-php/src/Platform/Platform.php on line 217

PHP Notice: Undefined index: extension in /app/www/vendor/ringcentral/ringcentral-php/src/Platform/Platform.php on line 218

PHP Notice: Undefined index: password in /app/www/vendor/ringcentral/ringcentral-php/src/Platform/Platform.php on line 219

PHP Fatal error: Uncaught Exception: Response has unsuccessful status in /app/www/vendor/ringcentral/ringcentral-php/src/Http/Client.php:44

Stack trace:

#0 /app/www/vendor/ringcentral/ringcentral-php/src/Platform/Platform.php(329): RingCentralSDKHttpClient->send(Object(GuzzleHttpPsr7Request))

#1 /app/www/vendor/ringcentral/ringcentral-php/src/Platform/Platform.php(465): RingCentralSDKPlatformPlatform->sendRequest(Object(GuzzleHttpPsr7Request), Array)

#2 /app/www/vendor/ringcentral/ringcentral-php/src/Platform/Platform.php(221): RingCentralSDKPlatformPlatform->requestToken('/restapi/oauth/...', Array)

#3 /app/www/rc_test.php(8): RingCentralSDKPlatformPlatform->login(Array)

#4 {main}


Next RingCentralSDKHttpApiException: Unauthorized for this grant type in /app/www/vendor/ringcentral/ringcentral-php/src/Http/Client.php:52

Stack trace:

#0 /app/www/vendor/ringcentral/ringcentral-php/src/Platform/Platform.php(329): RingCentralSDKHttpClient->send(Object(GuzzleHttpPsr7Request))

#1 /app/www/vendor/ringcentral/ in /app/www/vendor/ringcentral/ringcentral-php/src/Http/Client.php on line 52


Can you enable PWD (clientID: J2W7_NM5S46rnmS76HptSw) and JWT (clientID : kxHXJZJwRzW8W6EiwB_a5Q) at the same time?

PhongVu
Community Manager
Community Manager
December 5, 2022

This app (J2W7_NM5S46rnmS76HptSw) is currently set password flow. Do you want to enable JWT?

And this app (kxHXJZJwRzW8W6EiwB_a5Q) is set both password flow and JWT token as I set it for you last time.

And for the error. When did you update/install the RingCentral PHP SDK? Make sure to get the latest version which support JWT tokens.

The First Step
December 5, 2022

I am trying to test, but cannot create another JWT Token as I am receiving the error:
You have reached your limit of available sandbox logins. To increase this limit, please file a ticket with support.

PhongVu
Community Manager
Community Manager
December 5, 2022

What did you do when you got that error? Generate a new JWT token?

The First Step
December 5, 2022

2022-12-05-14-45-46-window.png2022-12-05-14-46-16-window.pngwhen I go to <my Name>, Credentials -> create JWT (as I don't have one) -> the sandbox option is greyed out.. and I have a pop up with:You need an account in the sandbox environment to select this option. Create login credential
which then brings me the error: You have reached your limit of available sandbox logins. To increase this limit, please file a ticket with support.

The First Step
December 7, 2022

Dear Dev Support

I am now able to create JWT token, but it seems that the CLIENTID = 'kxHXJZJwRzW8W6EiwB_a5Q' is still no set for JWT authentication. Can you please verify.

I even re-installed the PHP SDK with: (no change)

$ curl -sS https://getcomposer.org/installer | php

$ php composer.phar require ringcentral/ringcentral-php vlucas/phpdotenv

PhongVu
Community Manager
Community Manager
December 7, 2022

Your app auth type is JWT auth. Can I revoke the JWT token and regenerate a new one to test on your behalf?