laravel - Making it mendatory to get email with facebook oAuth with Socialite -
i trying use facebook oauth users login/register website. this, require user's email address
facebook oauth dialog has option provide / not provide email if user's doesn't provide email, cannot re-request authorization facebook again considers user logged in , redirects call url.
i using laravel , socialite package.
any solutions??
socialite allows user information directly after successful authorization using
$user = socialite::driver('facebook')->user(); $user->email;
i expect $user->email
contain users email address if accepted share app , empty if user denied email address sharing.
, if $user->email
empty throw error , ask user re-authorize. if it's not working try de-authroize user, guide can found here.
a convenient way avoid issues display warning user should allow email sharing if wants log in facebook.
Comments
Post a Comment