我正在尝试使用来自 https://github.com/facebook/facebook-php-sdk的 Facebook PHP SDK (v.3.2.0) 创建一个 facebook 登录 url 下面是我的代码
$config = array( 'appId' => '***',
'secret' => '***',
'cookie' => true
);
require_once("facebook.php");
$facebook = new Facebook($config);
$params = array('scope' => 'user_birthday, user_location, email',
'redirect_uri' => "http://my_domain.in/user/fb",
'display' => 'popup'
);
$loginUrl = $facebook->getLoginUrl($params);
问题是当 loginUrl 被点击时,它会从 facebook 给出错误,如下所示:
API 错误代码:100 API 错误描述:无效参数错误消息:显示类型弹出窗口。在 www.facebook.com 上无效。您应该访问不同的域(m.facebook.com、www.facebook.com),或使用以下支持的显示类型之一:page、popup、iframe、touch、none
问题是我哪里出错了?仅供参考,之前相同的代码很好,不知何故现在不起作用,我有点错过了问题实际上发生的时候,但在这之间我确实将 facebook-php-sdk 从 3.1.1 升级到 3.2.0,n 可能我的 facebook 应用程序中的域和 url 设置。
应用程序域:my_domain.in 网站网址:http ://www.my_domain.in
此外,即使我将参数更改为
$params = array('scope' => 'user_birthday, user_location, email',
'redirect_uri' => "http://my_domain.in/user/fb"
);
我仍然收到带有不同消息的错误
API 错误代码:100 API 错误描述:无效参数错误消息:不支持的范围:'电子邮件。'。支持的范围: ads_management create_event create_note emailexport_stream friends_about_me friends_activities friends_birthday friends_checkins friends_education_history friends_events friends_games_activity friends_groups friends_hometown friends_interests friends_likes friends_location friends_notes friends_online_presence friends_photo_video_tags friends_photos friends_questions friends_relationship_details friends_relationships friends_religion_politics friends_status friends_subscriptions friends_videos friends_website friends_work_history manage_friendlists manage_notifications manage_pages offline_access photo_upload publish_actions publish_checkins publish_stream read_friendlists read_insights read_mailbox read_page_mailboxes read_requests read_stream rsvp_event share_item sms status_update user_about_me user_activities user_birthday user_checkins user_education_history user_eventsuser_games_activity user_groups user_hometown user_interests user_likes user_location user_notes user_online_presence user_photo_video_tags user_photos user_questions user_relationship_details user_relationships user_religion_politics user_status user_subscriptions user_videos user_website user_work_history video_upload xmpp_login
请帮忙,谢谢。