You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the Basic Usage instructions for thephpleague/oath2-client, I have a php client that obatins a valid token from an Authentik server. I can use this token and expiration, etc. However no matter what I try, I cannot get user information out of Authentik. I've setup the $provider with the following:
After receiving a valid $accessTokem, I have called
$resourceOwner = $provider->getResourceOwner($accessToken);
var_dump($resourceOwner);
Instead of displaying anything of value, I see:
Fatal error: Uncaught UnexpectedValueException: Invalid response received from Authorization Server. Expected JSON. in {php_server}/vendor/league/oauth2-client/src/Provider/AbstractProvider.php:787 Stack trace: #0 {php_server}/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(767): League\OAuth2\Client\Provider\AbstractProvider->fetchResourceOwnerDetails(Object(League\OAuth2\Client\Token\AccessToken))
It appears the Authntik server is not responding with valid JSON and the oath2-client is throwing an error. I cannot find the proper way to request user information from Authentik. Is there a custom Third Party Provider that I should be using? Any help would be appreciated.
The text was updated successfully, but these errors were encountered:
Having similar issue with Authentik but in my case, I don't get any output from var_dump($resourceOwner);
EDIT: I figured it out. You must include the scopes parameter in the initialization. For example:
$provider = new \League\OAuth2\Client\Provider\GenericProvider([
'clientId' => 'XXXXXX', // The client ID assigned to you by the provider
'clientSecret' => 'XXXXXX', // The client password assigned to you by the provider
'redirectUri' => 'https://my.example.com/your-redirect-url/',
'urlAuthorize' => 'https://service.example.com/authorize',
'urlAccessToken' => 'https://service.example.com/token',
'urlResourceOwnerDetails' => 'https://service.example.com/resource',
'scopes' => 'openid profile email'
]);
Using the Basic Usage instructions for thephpleague/oath2-client, I have a php client that obatins a valid token from an Authentik server. I can use this token and expiration, etc. However no matter what I try, I cannot get user information out of Authentik. I've setup the $provider with the following:
'urlResourceOwnerDetails' => 'https://{server}/application/o/userinfo/'
After receiving a valid $accessTokem, I have called
$resourceOwner = $provider->getResourceOwner($accessToken);
var_dump($resourceOwner);
Instead of displaying anything of value, I see:
Fatal error: Uncaught UnexpectedValueException: Invalid response received from Authorization Server. Expected JSON. in {php_server}/vendor/league/oauth2-client/src/Provider/AbstractProvider.php:787 Stack trace: #0 {php_server}/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(767): League\OAuth2\Client\Provider\AbstractProvider->fetchResourceOwnerDetails(Object(League\OAuth2\Client\Token\AccessToken))
It appears the Authntik server is not responding with valid JSON and the oath2-client is throwing an error. I cannot find the proper way to request user information from Authentik. Is there a custom Third Party Provider that I should be using? Any help would be appreciated.
The text was updated successfully, but these errors were encountered: