iOS SDK method to login/register a user via Facebook

Hi Backendless Team, we use this iOS SDK method to login/register a user via Facebook and it worked well.
logingWithFacebook(accessToken: String, fieldsMapping: [String: String], responseHandler: ((BackendlessUser) -> Void)!, errorHandler: ((Fault) -> Void)!)
But currently, we have a registration problem. Old user logs in without a problem, but new user gets this error

Domain=BackendlessErrorDomain Code=3013 “Unable to register user. Missing identity value for ‘id’”

May you help us fix it?
Previously, there were no problems with generating this id field on your side

1 Like

Hello @Dmitry_Zausaev, I have created an internal ticket BKNDLSS-24664 to investigate the issue

1 Like

Hello @Dmitry_Zausaev,

I’ve created a new Facebook app, configured it, downloaded the FacebookLogin codegen app and everything works fine and new user has been registered without any problems.
Please make sure you’ve configured the Facebook settings correctly.
If the error still occurs, please provide a simple Xcode project with Facebook login that reproduces this issue.

Regards,
Olha

Hi @olhadanylova

The thing is, we have a custom identity set, it’s a string field called ‘id’. We use it instead of email for the cases when a user choses not to share an email with us via a social auth.
The API used to populate this identity field with a corresponding id of fb/google account (we also had to implement Apple Sign In ourselves because you said you’re not going to support it a year ago, it uses this field as well), but doesn’t do so any more. That’s why this error comes up. The id we need is present in some private user field oAuthIdentity or something.

Hi @Alexander_Shalamov !

Sorry for inconvenience. Your problem is caused by changes on our side - for support of multiprovider login for one user we moved all OAuth provider related info to separate field - “oAuthIdentities”. To fix your problem you should add beforeRegister event handler to populate your id field.

Regards, Andriy

Thanks!

We tried implementing it with a codeless handler, but the error persists.
Could you look at the sample and point us in the right direction?

Is it safe to assume that those print statements should appear in the real time logging console? (they dont)

hello @Alexander_Shalamov

we are investigating why it does not work for you

Hi @Alexander_Shalamov !

Sorry for misguiding you. You should use afterRegister handler instead. Data from OAuth provider is obtained during registration process and will be available only after it.
Sorry for inconvenience.

Regards, Andriy

Hi!

We did try it, but it didn’t help. Any other options?
Btw we’re testing it under a sandbox account and can’t deploy any more event handlers. It says we’ve reached a limit for our current plan, even tho we deleted most of them and currently have like 2.
Still can’t see anything in real time console.

Have you tried also afterOAuthRegister event handler?

Regards, Andriy

Hi!

We did, but it did not help either. There’s a different set or available user/request-related blocks and we couldn’t find an object to update with the ‘id’ property. In the attached screenshot there are 4 print statements all of them return null except for the first one. Request user properties return an object with ‘id’ property which seems like what we need. But where should we put that id?

Hi, I saw some new users with e-mail contains backendlessmail.com in TEAM section.
And also I see that Restore password option are not working now.

Is it result of some of yours actions?

Hi @Dmitry_Zausaev !

Hi, I saw some new users with e-mail contains backendlessmail.com in TEAM section.

Our team members connected themself to your app to collect more information about your case.

And also I see that Restore password option are not working now.

No, it is not related to the added team members. What kind of error do you receive when try to restore password? Is there any errors in your log?

About problems with identity column. Internal ticket BKNDLSS-24968 was created for your problem. During investigation we have discovered that the only possible solution for your scenario is to use custom fields mapping for your OAuth provider. Unfortunatelly column “id” is still considered as internal column and can’t be set directly via custom fields mapping. This will be fixed in one of next releases. Untill then I would recommend you to change your identity column name and use custom field mapping to fill this column. With this approach you will not need any additional event handlers.

Sorry for inconvenience.

Regards, Andriy

Hi, @Alexander_Shalamov

We have fixed the problem with Social login when the identity column is not email. Could you kindly let us know whether fix works for you well?

Regards,
Marina