首页 > 解决方案 > 脸书 API。签名请求-> {user_id,代码}

问题描述

非常主题。有API。通过前面获取身份验证

async function checkLoginState(response) {
      window.fbAsyncInit = function() {
        FB.init({
        appId      : 'X',
        cookie     : true,
        xfbml      : true,
        version    : 'v11.0'
        });
      };
      FB.getLoginStatus(function(response) {
        console.log(response);
        return response;
      });
    }

然后解码:

async function decode() {
      console.log(window.atob(resp.authResponse.signedRequest.split('.')[1]));
      return;
    }

最后有两个值的json。user_id还有一些code。如何通过该代码部分检查此 user_id 是否有效?(512+ 符号 ASCI)。脸书保持沉默……

不要为 async\promises 的错误编码而烦恼。试图检查选项=)

标签: javascriptapifacebook

解决方案


推荐阅读