开发者

OAuthException / An active access token must be used to query information about the current user

开发者 https://www.devze.com 2023-04-08 12:32 出处:网络
When trying: facebook requestWithGraphPath:@\"me/friends\" In my iOS app I get the error \"OAuthException / An active access token must be used to query information about the current user\"

When trying:

facebook requestWithGraphPath:@"me/friends"

In my iOS app I get the error

"OAuthException / An active access token must be used to query information about the current user"

I can query my own Facebook data successfully usng 开发者_运维技巧requestWithGraphPath:@"me", and I can use the token I have to get data from

https://graph.facebook.com/me/friends?access_token=xxxx

in the browser. But it won't work in the iOS app...

Can anyone help? I tried recreating a new Fb app, as I had been removing my initial test one from my approved apps and I thought that might have caused it, but the result is the same. I am requesting "offline access" in my permissions so the token shouldn't expire.

EDIT: Interestingly querying the FQL user table returns my friend list IDs


Although This is an old post but I am answering it for the followers:

Whenever you post something with facebook graph API, You must get permissions for atleat "publish_stream" Plus be sure to post to the Wall when you receive the authorization e.g

if (![SharedFacebook isSessionValid])
 {
     NSArray *permissions = [[NSArray alloc] initWithObjects:@"offline_access", @"publish_stream", nil];
     [SharedFacebook authorize:permissions];///Show the login dialog

     /// [self postToWall];///Do not call it here b/c the permissions are not granted yet and you are posting to the wall.
  } 
else
 {        
    [self postToWall];
 }
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号