网站的手动Facebook登录-检查访问令牌

网站的手动Facebook登录-检查访问令牌,facebook,facebook-login,Facebook,Facebook Login,我引用了这个Facebook页面来为我的网站建立一个登录脚本 以下是上一页的步骤摘要: 获取授权码 为访问令牌交换代码 检查访问令牌 查询图Api 在第三步中,Facebook需要以下参数 (I used the access token from step 2 here) input_token {token-to-inspect} // An app access token or an access token for a developer of the app. (Should

我引用了这个Facebook页面来为我的网站建立一个登录脚本

以下是上一页的步骤摘要:

  • 获取授权码

  • 为访问令牌交换代码

  • 检查访问令牌

  • 查询图Api

  • 在第三步中,Facebook需要以下参数

    (I used the access token from step 2 here)
    input_token   {token-to-inspect}
    
    // An app access token or an access token for a developer of the app.
    (Should i use my FB app id ?)
    access_token  {app-token-or-admin-token}
    
    访问令牌应该包含什么?我插入了我的FB应用程序id,但得到以下响应

    HTTP/1.1 400 Bad Request
    WWW-Authenticate: OAuth "Facebook Platform" "invalid_token" "Invalid OAuth access token."
    

    不确定该错误是由于用户访问令牌过期还是由于输入参数错误造成的。

    我进一步阅读并找到了关于

    您可以生成应用程序访问令牌

    curl -X GET "https://graph.facebook.com/oauth/access_token
    ?client_id=your-app-id
    &client_secret=your-app-secret
    &redirect_uri=your-redirect-url
    &grant_type=client_credentials"
    
    或按如下所示设置访问令牌参数

    access_token=your-app_id|your-app_secret
    

    我尝试了后者your-app_id | your-app_secret,效果很好。

    后者。应用程序id不是令牌。如果您对代币不确定,请使用您已经在的文档页面上的侧边导航,并阅读它们。