Facebook Easy Login in iOS

Hello everyone sorry … but I’m fighting more for the facebook login to all my app …
I’m trying to follow the guidance in the documentation for the “esay to faceook login” in iOS … When I finished follow the guide and try to test your facebook login, the facebook page gives me this error:
"Given URL is not allowed by the Application configuration .: One or more of the given URLs is not allowed by the App’s settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App’s domains . "
I tried to put this url “https://api.backendless.com” in WEB on in the settings of my app on Facebook and gives me this other error:
“Could not approve company accounts.”
Honestly I’m not understanding anything … where am I doing wrong? can you help me?

Hi Fabio,

Did you follow the instructions from this page in the docs?: https://backendless.com/documentation/manage/mgmt_social_settings.htm

Regards,
Mark

I’ve followed this documentation, but I did not get any results … also because the facebook developer site has changed … anyway that 's what I did but I still riscevere negative errors

Do you get an error when you click the “Save Changes” button?

no… i’m received error only when click on button “Login with Facebook” … the App open safari browser and get the error

I do not understand this comment then:

I tried to put this url "[url=https://api.backendless.com%22/]https://api.backendless.com"[/url]; in WEB on in the settings of my app on Facebook and gives me this other error:
"Could not approve company accounts."

Where are you getting that error?

excuse me… my translator in very bad…

After click on Login with Facebook and safari open browser with address api.backendless.com i’m received this error:

“could not approve social account”

Please open the following in Backendless Console:

Manage > App Settings > Social Settings

Do you have values for Facebook app id and secret?:
https://monosnap.com/file/OQApgZe6A6c5qcoWxCq9DzOhwXO1Kg

you’ve inserted the keys as documentation … I also deleted the keys and insert it again to see if my mistake or not but also putting all again I did not get results … I always make the same mistake

Hi Fabio!

Could you provide your code (where you use facebook easy login method)?

I followed the documentation
https://backendless.com/documentation/users/ios/users_facebook_login.htm

I generated the code from the backendless console and reported in my app

viewController.m

- (IBAction) loginWithFacebook: (id) sender {
    [backendless.userService
     easyLoginWithFacebookFieldsMapping: @ {@ "email" @ "email", @ "username" @ "username" @ "USER_LOCATION": @ "USER_LOCATION"}
     permissions: @ [@ "email"]
     Response: ^ (id response) {
         NSLog (@ "% @", response);
         [Self.navigationController popToRootViewControllerAnimated: YES];


     }
     error: ^ (* Fault fault) {
         NSLog (@ "% @", fault.detail);
     }];
}

appDelegate.m

- (BOOL) application: (UIApplication *) application openURL: (NSURL *) url sourceApplication: (NSString *) sourceApplication annotation: (id) {annotation
    BackendlessUser * user = [backendless.userService handleOpenURL: url];
    if (user) {
        // Apply your logic for the successful login. For example, the view switches
    }
    return YES;
}

Hi Fabio,

You can investigate the working example of facebook login in our github: https://github.com/Backendless/iOS-Samples/tree/master/samples/objective-c/backendlessDemos/UserSocial

Regards,
Slava

Please remove USER_LOCATION and username from fields mapping and try again.

it now works … has problems when calling the USER_LOCATION and username …
Now it all works … found the problem! Thanks a lot guys … a little question … why in the email field I visualize just numbers instead of the User via the email facebook?

This issue (number values in email property) I can not reproduce with generated sample.
Please re-check if you have correct mapping for email:

 easyLoginWithFacebookFieldsMapping:@{@"email":@"email"}

and permissions for retrieving email value:

 permissions:@[@"email"]
    [backendless.userService
     easyLoginWithFacebookFieldsMapping:@{@"email":@"email",@"first_name" : SIGNUP_FIRSTNAME, @"last_name" : SIGNUP_LASTNAME}
     permissions:@[@"email"]
     response:^(id response) {
         NSLog(@"%@", response);
         [self.navigationController popToRootViewControllerAnimated:YES];


     }
     error:^(Fault *fault) {
         NSLog(@"%@", fault.detail);
     }];

i’m try this code but in email field (dashboard data ) received a number :frowning:

Fabio, I opened an internal ticket to investigate this problem.

Regards,
Mark

Hi Fabio,

I checked this issue - it seems it is alright.

Here my code:

            [backendless.userService
             easyLoginWithFacebookFieldsMapping:@{@"email":@"email", @"name":@"name"}
             permissions:@[@"email"]
             response:^(id response) {
                 //response - NSNumber with bool Yes
                 NSLog(@"StartViewController -> login: (Facebook) result = %@", response);
             } error:^(Fault *fault) {
                 NSLog(@"StartViewController -> login: (FAULT) %@", fault.detail);
             }];


and result on the app dashboard:
http://support.backendless.com/public/attachments/4305b5d2f87fffeca3fc397991d99e8b.png</img>

Can you try again, and let me know here how it goes?

Regards,
Slava

Hello , I am trying to use the integration Login with Facebook / backendless .

I followed the tutorial https://backendless.com/documentation/manage/mgmt_social_settings.htm

When first run , the app worked perfectly.

Soon after I entered the backendless site / my application / users table and deletes the user.

I ran the application again, but did not succeed .
The application opens the URL of the facebook, but then immediately and directed to url api.backendless.com

then the SAFARI BROWSER sends the following error message

Can not Open Page
Safari can not open the page because the address is invalid

What is the URL of the page which it cannot open?