-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
if you're like me, you have this error: [Not enough permissions to access: me.GET.NO_VERSION
I trigger when I try to make this call:
#[Route('/oauth/linkedin/check', name: 'connect_linkedin_check')]
public function checkLinkedin( ClientRegistry $clientRegistry)
{
$client = $clientRegistry->getClient('linkedin');
$user = $client->fetchUser(); // <--- it comes exactly from this call, as it uses LinkedIn's proprietary API https://api.linkedin.com/v2/me
dd($user);
return $this->redirectToRoute('accueil');
}I replaced it with this and now I have no more errors and I can retrieve data from the client :
#[Route('/oauth/linkedin/check', name: 'connect_linkedin_check')]
public function checkLinkedin( ClientRegistry $clientRegistry)
{
$client = $clientRegistry->getClient('linkedin');
$accessToken = $client->getAccessToken();
$response = $client->getOAuth2Provider()->getAuthenticatedRequest( 'GET',
'https://api.linkedin.com/v2/userinfo',
$accessToken
); // <--- endpoint standard OpenID Connect.
$userinfo = $client->getOAuth2Provider()->getParsedResponse($response);
dd($userinfo);
return $this->redirectToRoute('accueil');
}
```
Hopefully this will help some of you and save you a day of dealing with this problem.
NB : I won't put it here, but make sure you've set up the ‘knpu_oauth2_client.yaml’ file properly 😉 INFOTECH974, LoicLEMEUT and PsY4
Metadata
Metadata
Assignees
Labels
No labels