使用社交名流Laravel检索Facebook用户详细信息 [英] Retrieve facebook user details with using socialite laravel

查看:134
本文介绍了使用社交名流Laravel检索Facebook用户详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用laravel 5.4.36版,并且正在使用 Laravel Sociallite插件将用户与Facebook联系起来.

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.

我尝试了以下代码

     $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();

现在,当我单击带有Facebook按钮的登录名时,它会显示类似

Now when i click on login with facebook button it shows error like

无效范围:user_birthday,user_location.此消息仅显示给开发人员.您的应用程序用户将忽略这些权限(如果存在).请在以下位置阅读文档以获取有效权限: https://developers.facebook.com/docs /facebook-login/permissions

我尝试了不同的范围,例如字段名称=年龄和范围= user_age_range 字段名称=生日,范围名称= user_birthday,字段名称=朋友,字段名称= user_friends

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.

我做错什么了吗?我是否需要更改我为登录而创建的Facebook应用程序中的某些内容?

Am i doing something wrong ? Do i need to change something in facebook application which i have created for login ??

请提出建议.

推荐答案

好吧,事实证明这毕竟与复习有关-如果只是间接的话.

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.

这篇关于使用社交名流Laravel检索Facebook用户详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆