dongma7796 2019-07-06 12:25
浏览 71

Facebook检查PHP上令牌的有效性

I did authorization with facebook in PHP for this example https://developers.facebook.com/docs/php/howto/example_facebook_login/

Facebook has test documentation https://developers.facebook.com/docs/facebook-login/testing-your-login-flow/

Take for example this "6. Someone changes the Facebook password after logging in with Facebook to your app".

To implement this, I take a token from the session and check whether the token has expired. I do this every time a user opens a page of the site.

Everything worked fine and the user left the session for example when changing the password from facebook. But now facebook has made rate limits and when I do a check for an expired token, it ends quickly.

I don't understand what I have to do with this. How do I check the validity of a token in PHP? Please help.

if(key_exists('fb_token', $_SESSION))
{
    $tokenMetadata = facebook()->getOAuth2Client()->debugToken(
        $_SESSION['fb_token']
    );

    if($tokenMetadata->getIsValid())
        return $_SESSION['fb_user_id'];

    return false;
}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 程序不包含适用于入口点的静态Main方法
    • ¥15 素材场景中光线烘焙后灯光失效
    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记