I am following the quickstart guide for PHP Laravel and have made my own custom UserRepository class. When I try to do login with linkedin though, in the $profile
variable I don’t have access to name or email, there is only the sub value. This is the code in the quickstart:
protected function upsertUser( $profile ) {
return User::firstOrCreate(['sub' => $profile['sub']], [
'email' => $profile['email'] ?? '',
'name' => $profile['name'] ?? '',
]);
}
My code:
protected function upsertUser( $profile ) {
dd($profile);
return User::firstOrCreate(['sub' => $profile['sub']]);
}
When I die and dump the $profile
variable I only have access to the sub
key. I am wondering, how can I return back the email
value on the $profile
object?
dd result:
On the auth0 dashboard under Connections → Social → LinkedIn I have the email address box checked. My question is how can I access the users email on the $profile
object in the upsertUser
function?
In the LinkedIn developer console I have the email permission enabled: