Ahd Radwan
Ahd Radwan

Reputation: 1100

Facebook SDK remove app permissions programmatically

I'am working in an iOS application that requests user Facebook login with a list of permissions.

I can check if the user have declined some of the requested permission by this method
[[[FBSession activeSession] permissions] isEqualToArrayOfStrings:permissions] and remove the session.
But the problem is if the user tried to login again ,The Facebook SDK doesnt request for the permissions again it shows a view says

"you have already authorized XXXXX "

And doest ask the user to accept the permissions he has declined before. Because of this i need revoke or delete the user permissions from his Facebook account to be able to ask for permissions again ;

Upvotes: 2

Views: 1214

Answers (2)

iPao
iPao

Reputation: 1163

For swift version

let connection = GraphRequestConnection()
connection.add(GraphRequest(
    graphPath: "/me/permissions",
    parameters: [:],
    httpMethod: .delete
)) { httpResponse, result, error in 
// Handling
}
connection.start()

Upvotes: 0

Ahd Radwan
Ahd Radwan

Reputation: 1100

I found the answer in this link Revoke Login

[[[FBRequest alloc]initWithSession:[FBSession activeSession] graphPath:@"me/permissions" parameters:nil HTTPMethod:@"delete"] startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
    // Handling 
                 }];

Upvotes: 4

Related Questions