I have a backend service that will log me in my app and return an extended facebook token from previous login, possibly from another device (so no credentials cached on this device). I want to use this token to start a Facebook Session. I am using something like:
FBSession* session = [[FBSession alloc] initWithPermissions:@[@"publish_actions"]];
FBAccessTokenData* tokenData =
[FBAccessTokenData createTokenFromString:token
permissions:@[@"publish_actions"]
expirationDate:nil
loginType:FBSessionLoginTypeTestUser
refreshDate:nil];
[session openFromAccessTokenData:tokenData completionHandler:nil];
I am here passing 'nil' for clarity, in my code I am handling the completion and loggin the session object returned which appears to be in an Open state with no errors. When I try and use the session I get an error like:
Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0xb8b1680 {com.facebook.sdk:HTTPStatusCode=403, com.facebook.sdk:ParsedJSONResponseKey={
body = {
error = {
code = 200;
message = "(#200) The user hasn't authorized the application to perform this action";
type = OAuthException;
};
};
code = 403;
}, com.facebook.sdk:ErrorSessionKey=<FBSession: 0xa2b62a0, state: FBSessionStateOpen, loginHandler: 0xa29e9b0, appID: 131721883664256, urlSchemeSuffix: , tokenCachingStrategy:<FBSessionTokenCachingStrategy: 0xa273f60>, expirationDate: 4001-01-01 00:00:00 +0000, refreshDate: 2013-07-26 16:21:10 +0000, attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:(
email,
"publish_actions"
)>}
Any suggestions...?