0

I'm trying to log in with Facebook using Parse.com's PFFacebookUtilsV4. I'm using their standard:

 PFFacebookUtils.logInInBackgroundWithReadPermissions(["public_profile"])

{ (user, error) in

When I have connected my FB account to my iPhone in my iPhone's settings. I get an error with code 307 (shown below) every time. If I delete the FB/iPhone account connection from my iPhone's settings, the error goes away and the standard authentication happens. I'm testing on my phone. I have the FB app on my phone, but that doesn't seem to affect the error. Just having it connected via my iPhone's settings.

enter image description here

Eric
  • 197
  • 3
  • 12
  • can you share some more information on what are you trying to do and what steps did you take. – Singh Aug 02 '16 at 09:29
  • @Singh added some more info for you. Thanks! – Eric Aug 02 '16 at 17:36
  • What version of Parse, PFFacebookUtils, and FBSDK are you using? Are they all the latest? I seem to remember they ditched the native login and instead are forcing everyone to use the Safari web view for login. Are you forcing which login method it's trying to use? – Chad Pavliska Aug 02 '16 at 18:57

2 Answers2

0

After digging deeper into the stack trace, I found a different error. This solved it iOS 6 Facebook posting procedure ends up with "remote_app_id does not match stored id"

Community
  • 1
  • 1
Eric
  • 197
  • 3
  • 12
0

Just in case anyone has any other errors with login with Facebook on parse here's what I learnt

Add this key to your parse server dashboard FACEBOOK_APP_ID (near where you add MASTER_KEY)

You will have to switch up from the following method

[PFFacebookUtils logInWithPermissions:permissionsArray block:^(PFUser *user, NSError *error) {

to first executing the standard Facebook get token

FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
[login logInWithReadPermissions: @[@"public_profile"]
             fromViewController:self
                        handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
     if (error) {       
         NSLog(@"Process error");       
     } else if (result.isCancelled) {     
         NSLog(@"Cancelled");     
     } else {   
         NSLog(@"Logged in");

         NSString *facebookUserId   = [FBSDKAccessToken currentAccessToken].userID;
         NSString *accessToken      = [FBSDKAccessToken currentAccessToken].tokenString;
         NSDate *expirationDate     = [FBSDKAccessToken currentAccessToken].expirationDate;

         [self loginFacebookUserWithTokenInfo:facebookUserId
                                  accessToken:accessToken
                               expirationDate:expirationDate];
     }
 }];

Then you login using the following section of code

[PFFacebookUtils logInWithFacebookId:facebookId
                         accessToken:accessToken
                      expirationDate:expirationDate
                               block:^(PFUser *user, NSError *error) {

                                       if (error) {             
                                           NSLog(@"Error!");
                                       } else {
                                           NSLog(@"User logged in through Facebook and parse!");
                                           // do as you please
                                       }
                                   }];
James Zaghini
  • 3,895
  • 4
  • 45
  • 61
t.ios
  • 1,024
  • 12
  • 18