简体   繁体   English

Facebook SDK AppRequests错误:OAuthException

[英]Facebook SDK AppRequests Error: OAuthException

I want to read the user's apprequest-id. 我想读取用户的apprequest-id。 I've already finish the function below: 我已经完成以下功能:

  1. get server token: 获取服务器令牌:

     url = "https://graph.facebook.com/oauth/access_token?client_id=#{app_id}&client_secret=#{secret_key}&grant_type=client_credentials" 
  2. then, i built the function that sending user_token to server as {client_access_token} 然后,我建立了将user_token作为{client_access_token}发送到服务器的功能

  3. So, I call this function to get AppRequest as json 因此,我调用此函数以将AppRequest获取为json

     url = "https://graph.facebook.com/v2.3/#{fb_id}/apprequests/?input_token=#{client_access_token}&access_token=#{server_access_token}" 

And i got this error: 我得到了这个错误:

     {
      "error": {
          "message": "(#15) Requires session when calling from a desktop app",
          "type": "OAuthException",
          "code": 15
         }
     }

At first, I think that there are something wrong with the URL calling or access token, but I've already test another graph api such as "/me/friends" and "/me/?fields=installed" with the same input_token and access_token. 一开始,我认为URL调用或访问令牌有问题,但是我已经用相同的input_token和另一个测试了图api,例如“ / me / friends”和“ / me /?fields = installed” access_token。 And, it works normally. 并且,它正常工作。 Please help. 请帮忙。

通过使用{client_access_token}作为access_token解决了此问题:)

    url = "https://graph.facebook.com/v2.3/#{fb_id}/apprequests/?access_token=#{client_access_token}"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM