问题
I am using laravel version 5.4.36 and i am using Laravel Sociallite plugin to connect user with facebook.
Now i want to get Logged in user information like birth date gender, Address, mobile number or any permissions given in this facebook official document.
I have tried following code
$facebookScope = [
'user_birthday',
'user_location',
];
$facebookFields = [
'name', // Default
'email', // Default
'gender', // Default
'birthday', // I've given permission
'location', // I've given permission
];
return Socialite::driver('facebook')->fields($facebookFields)->scopes($facebookScope)->redirect();
Now when i click on login with facebook button it shows error like
Invalid Scopes: user_birthday, user_location. This message is only shown to developers. Users of your app will ignore these permissions if present. Please read the documentation for valid permissions at: https://developers.facebook.com/docs/facebook-login/permissions
I have tried different scopes like field name = age and scope = user_age_range field name = birthday and scope name = user_birthday for field name = friends and field name = user_friends
for every scope that i used i get error of invalid scope.
Am i doing something wrong ? Do i need to change something in facebook application which i have created for login ??
Please suggest.
回答1:
Ok, turns out this is related to review after all - if only indirectly.
You now need to have your app in “dev” mode, to be able to ask even people with a role in the app for those permissions.
Once you set it “live”, it will show the “invalid scopes” error, even if you are testing with a admin or developer account.
The phrasing of the error message is a bit misleading/unlucky in that regard.
回答2:
You need to explicitly declare scopes you need on your facebook apps page. Open you https://developers.facebook.com/apps/ dashboard, go to app review and submit item you need scope on. After that you need to comply to facebook request usually involved screen capture of login flow and feature usage.
Be noted that this process takes quite a long time. Some of apps I create scheduled to be reviewed on early august.
回答3:
user_birthday
, user_location
, user_friends
there are lots of other scopes that needs review from facebook before make it available to public user. However you can use these scopes for developer and test users account.
https://developers.facebook.com/docs/apps/review/
来源:https://stackoverflow.com/questions/50965285/retrieve-facebook-user-details-with-using-socialite-laravel