When logging in with Facebook using swift 3, we are getting an error.

Have you heard of this issue before? We are using FB’s latest SDK to log in. Do you have a sample project you can send us with updates for swift 3 and the latest FB SDK?

When the login with Facebook button is clicked, we are able to login with our Facebook credentials. Once we login with the Facebook credentials, we see a white screen. That is all. Nothing gets logged in.

There is our Facebook SDK sample project in attachment. It works for us.
You could try it with your appId and secretKey - how will it work for you?

You can change also your Facebook App ID in Info.plist:

Regards,
Slava

TestS3FacebookSDKLogin.zip (20.21MB)

Perfect. This is very helpful. Thank you!

I just tried running this project. Now it is giving me an error using the exact project that you sent us. I did not change anything in the project. Do you have any idea what might be causing this?

“ERROR: token = nil”

Did you set Facebook App ID in the URL Schemes?

It was already set by Vyacheslav in the URL Schemes but I did try it with our Facebook App ID as well and it gave the same error. This is using the attached project above.

If you use the same project (and I assume you changed App ID and Secret Key to your app) the difference must be in the Facebook App configuration.

We can look into how you configured your facebook app, but that level of support would require you to purchase single incident support. See details here: https://backendless.com/support-policy/

I am using your app id as well. That is returning the same result. All I am doing is downloading the project attached above and clicking run and it returns the error, “ERROR: token = nil” after I click the Login with Facebook button. I have included a screenshot of the errors I am getting in the console.

Hi Nevin,

You can get “ERROR: token = nil” if ‘email’ is an identity in User Properties of your app, and user try to register using Facebook account which has the same email as already existing user has.
Please check this.

Regards,
Slava

Shouldn’t that log the user in? Do you have the code for it to log the user in? We will have users who log out and then need to log back in again using Facebook.

On our instance of our app, my email address is logged in only as a Facebook user not as an non-facebook user and it is still giving me this error. On your instance of Backendless in the User Properties of your app, I am also logged in as only a Facebook User. There is no way I would have been able to log into your instance in any other way.

When I refer to your instance of Backendless, I am referring to the instance with this keys: 11F87440-6823-01F4-FF7E-A899467C0400

Did you check our sample with our appId and secretKey?

I also deleted all my facebook accounts from our Backendless instance and tried to login and it is still giving us the same error.

We finally figured out the problem. We needed to use FB SDK version 4.15.1. The latest version was not working and returning nil.

We also had to go to the Project Target and then Capabilities and switch Keychain Sharing ON. See the below issue.

Ok, Nevin, thank you for information.