我正在使用 Facebook PHP SDK 进行 facebook 登录,为用户提供舒适的选择。但我也想检查用户的 facebook 帐户是否已验证。对于电子邮件,有一个简单的解决方案 - 如果您请求“获取电子邮件权限”并且用户接受 - Facebook 然后仅在经过验证后才会向您提供电子邮件。
事实是,越来越多的用户使用手机验证他们的帐户。我不想向用户请求电话号码,所以...
我如何进行某种常规检查以确保特定 Facebook 用户拥有经过验证的帐户? 这可能吗?
最佳答案
愚蠢的我,可以通过 Facebook Graph API 查看 https://developers.facebook.com/docs/graph-api/reference/v2.0/user了解更多信息。
Graph API 的返回之一是一个名为“verified”的键 - 它给出 bool 值,resp。 1 或 0。
Indicates whether the user account has been verified. This is distinct from the is_verified field. Someone is considered verified if they take any of the following actions: Register for mobile Confirm their account via SMS Enter a valid credit card
使用示例:
$me = yourApiCall(...); // your own call to https://graph.facebook.com/me
$me = json_decode($me); //convert JSON to PHP object
if( $me->verified ){
// is verified
} else {
// is NOT verified
}
不要混淆 is_verified 做其他事情:
People with large numbers of followers can have the authenticity of their identity manually verified by Facebook. This field indicates whether the user profile is verified in this way.
https://stackoverflow.com/questions/23467755/