Search code examples
iosfacebookcordovaphonegap-plugins

iOS phonegap-plugin-facebook-connect vs Facebook iOS Application


I've been trying to make phonegap-plugin-facebook-connect cordova plugin Simple example work, and i've experienced a weired problem.

  • First I had the Facebook iOS application on my iphone:

On my test application based on the Simple example, when i click the Login button, it just switches to the Facebook iOS app, and switches back to my application.

Clicking the "Me" button gives me an error "an active access token must be used to query information about the current user" which means the login was not successful

  • Then I removed the Facebook iOS application from my iPhone:

It worked. It opens Safari with Facebook authorisation page, when i click OK it switches back to my application and the auth.login events are successfully fired.

Is this a known issue ? Is there a way to fix it ?

Thank you


Solution

  • I found a workaround:

    in Facebook.m

    - (void)authorize:(NSArray *)permissions {
      self.permissions = permissions;
    
     [self authorizeWithFBAppAuth: NO safariAuth:YES]; //Use Safari Auth instead of FB App
    }
    

    With this workaround Facebook iOS authorization will not be used, wheter installed or not.

    Github issue#25