-2

I am using below code using share a post to facebook.

if ([[FBSDKAccessToken currentAccessToken] hasGranted:@"publish_actions"]) {
[[[FBSDKGraphRequest alloc]
initWithGraphPath:@"me/feed"
                 parameters: @{ @"message" : @"hello world"}
           HTTPMethod:@"POST"]
startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
if (!error) {
  NSLog(@"Post id:%@", result[@"id"]);
}
}];
}

If i want to post a status update, this requires publish_actions permissions. But i did't get permission so how can i get and also adding this permission.

Please help me....

narendrakumar b
  • 115
  • 1
  • 12

1 Answers1

1

The access token holds the "scope" information which indicates the permissions allowed to the specific user.

In order to get the publish_actions for your app, you need to apply for a review to Facebook by submitting the additional permissions you need. Once that is approved you will be able to get appropriate access tokens.

You can get an access token by sending a request to Facebook like this:

https://www.facebook.com/dialog/oauth/access_token?   client_id={app-id}   &redirect_uri={redirect-uri}   &scope={scope-params}

client-id: each app you created in Facebook has such a client-id. you can see it in the dashboard under facebook-developers. (of course, that means that you have to create such an app in Facebook)

In scope you have to name all the permissions you want to use (comma-separated). You can find an overview here: https://developers.facebook.com/docs/facebook-login/permissions

Note that access_token has an expiration set. so it may be outdated at some time.

Eric Galluzzo
  • 3,191
  • 1
  • 20
  • 20
QuickSort
  • 494
  • 5
  • 14