Search code examples
iosfacebookfacebook-graph-apifacebook-ios-sdk

Have an active accesstoken, but still getting the error - An active access token must be used to query information about the current user


An active accesstoken is available, but I am still getting an error while using the latest Facebook SDK like

code = 2500;
message = "An active access token must be used to query information about the current user.";

Below is the code I am using.

if (!appDelegate.session.isOpen) 
{
    appDelegate.session = [[FBSession alloc] initWithPermissions:[NSArray arrayWithObject:@"status_update"]];
    NSLog(@"Access Token Available == %@", appDelegate.session.accessTokenData.accessToken);

    [FBRequestConnection startWithGraphPath:[NSString stringWithFormat:@"me/feed"] parameters:[NSDictionary dictionaryWithObjectsAndKeys:@"Testing from iOS", @"description",@"Testing FB Status Update", @"message", nil] HTTPMethod:@"POST" completionHandler:^(FBRequestConnection *connection, id result, NSError *error){
        if(error)
        {
           NSLog(@"Error = %@", error);
        }
        else
           NSLog(@"Posted !");

    }];
}

What is the actual problem...?

Thanks


Solution

  • In the parameter list add access_token parameter too.

    You can also verify the access token here: http://developers.facebook.com/tools/debug