简体   繁体   English

facebook php $facebook->getLoginUrl email user_location 无效

[英]facebook php $facebook->getLoginUrl email user_location no effect

Using the latest Facebook PHP SDK 3使用最新 Facebook PHP SDK 3

I want to get access to email and possibly user_location, however, when I use the following code, it gets to the Request for Permission page, but I don't see email or user_location listed.......just the normal one that says "Access my basic information'我想访问 email 和可能的 user_location,但是,当我使用以下代码时,它会进入 Request for Permission 页面,但我没有看到 email 或 user_location 列出......只是正常的一个上面写着“访问我的基本信息”

  $loginUrl = $facebook->getLoginUrl(array('req_perms' => 'email, user_location'));

then然后

$user_profile = $facebook->api('/me');

also doesn't return the email...也不返回 email ...

could someone give me some idea what might be the problem?有人可以给我一些想法可能是什么问题吗?

I GOT IT我知道了

got it, it needs to be 'scope' PHP SDK 3, NOT 'req_perms' =)明白了,它需要是“范围”PHP SDK 3,而不是“req_perms”=)

I believe you need to ask extended permission to get the email address of a user.我相信您需要请求扩展权限才能获取用户的 email 地址。 In the permissions "Scope", included "email" in the array like:在权限“范围”中,在数组中包含“电子邮件”,如:

    $params = array(
  'scope' => 'email, read_stream, friends_likes',
  'redirect_uri' => 'https://www.myapp.com/post_login_page'
);

$loginUrl = $facebook->getLoginUrl($params);

This works for me with php sdk这对我有用 php sdk

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM