php - Facebook 登录 - 检查用户是否拥有有效/经过验证的 Facebook 帐户

我正在使用 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/

相关文章:

php - Laravel:模型内验证。多重验证规则

asp.net-web-api - 当 WebApi 序列化失败时,我希望异常冒泡而不是 null

asynchronous - 带有 zmq_proxy 和回复的 ZeroMQ 异步客户端

xml - 使用 XSLT 转换在 WordProcessingML 中保留换行符和空格

session - Laravel 4.1 session 变量被随机遗忘

python - 用python编写的鼠标运动跟踪程序

macos - 通过 XPC 与应用程序通信并启动以 root 身份运行的守护进程

sql - 在 NLTK 中将英语转换为 SQL

mongodb - 为什么 mongo 的升序/降序排序顺序会为日期字段翻转?

ios - 解码Code128条码?