Hi. I have a problem with easyfacebooklogin which occurs only if I’m registering new backendless user for the very first time from a given facebook account . So it happens only right after allowing my app to use my facebook account.
The problem is that the:
-(BOOL)application:(UIApplication *)application openURL:(nonnull NSURL *)url sourceApplication:(nullable NSString *)sourceApplication annotation:(nonnull id)annotation
method isn’t being called in that situation. And if I restart the app the user is already saved (because of stayLoggedIn metod) but nothing works. So it looks like locally my app thinks the user is logged in but in reality it isn’t. To fix this i have to switch stayLoggedIn to NO and rerun the changed app OR i can click the log-in button again and sign in with facebook one more time and then it works but I guess a natural reaction of an average user would be to restart the app after which the app is unusable.
After fixing it I can register and delete as many users linked to my facebook account as I want and everything works fine. The problem occurs only after first registration/use of my backendless app with my fb account.
Ok my bad. The function is called. The problem is that the user returned by: [backendless.userService handleOpenURL:url] has no properties. And it happens only on first use of my app with a facebook account. Next time it downloads properties just fine. I can even delete the user and register another one and everything is okay. But if I “forget” my app in facebook settings and authorize it again the problem occurs. So it the problem applies only to users that register to my app for the first time from their fb account. Is there a way to update my local [backendless.userService currentUser] object and download those missing properties? I can’t just query for it by objectId because all of the properties of currentUser are nil.
Hi Bartek,
We have UserSocial sample in our iOS-Samples github, which demonstrated an easy login with Facebook, Twitter & Google+. You could investigate it.
This sample works fine for me, I just logged in and retrieved a currentUser with all my properties:
http://support.backendless.com/public/attachments/6ddb5dca38d10a2e3d195ee63f9bb935.png</img>
Regards,
Slava
I use the exact same code for my logging and on almost all occasions it works fine. But everytime I register a user from a new facebook account that hasn’t already authorized my backendless app, the user returned from: [backendless.userService handleOpenURL:url] has no properties. If I log-in again it works, if I delete the BackendlessUser and register again from that facebook account everything works because the facebook account remembers my app. If I forget the app in my fb settings and then register the user, the problem occurs again. So it happens only when Im authorizing my app for the first time as though the fb authorization took some extra time and the received URL pointed to a not yet created user object. I’m just guessing. That’s my log:
2016-04-08 00:42:49.416 Crumbler[5399:485166] UserService -> easyLoginResponder:
[url=https://www.facebook.com/dialog/oauth/?client_id=1009200319154000&redirect_uri=]2016-04-08 00:42:49.675 Crumbler[5399:485166] UserService -> easyLoginResponder:
[/url][url=https://www.facebook.com/dialog/oauth/?client_id=1009200319154000&redirect_uri=]2016-04-08 00:43:20.655 Crumbler[5399:485166] UserService -> handleOpenURL: url.scheme = 'backendlessaf8a86a4-7119-38e0-ff83-2b15a0076e00'
2016-04-08 00:43:20.657 Crumbler[5399:485166] UserService -> handleOpenURL: JSONObject = '{"lastLogin"#_=_'
2016-04-08 00:43:20.657 Crumbler[5399:485166] UserService -> onLogin: response = (null)
backendless.headers = {
"api-version" = "1.0";
"application-id" = "my-app-id";
"application-type" = IOS;
"secret-key" = "my-secret-key";
}
[/url]
Only upon another login i get:
UserService -> onLogin: response = {
"___class" = Users;
"__meta" = "{\"relationRemovalIds\":{},\"selectedProperties\":[\"created\",\"facebookId\",\"fullName\",\"ownerId\",\"deviceId\",\"__meta\",\"__updated__meta\",\"facebookMail\",\"showPicture\",\"surname\",\"name\",\"___class\",\"updated\",\"objectId\",\"email\"],\"relatedObjects\":{}}";
created = "Thu Apr 07 22:43:17 UTC 2016";
deviceId = "<null>";
email = myemail;
facebookId = myfacebookId;
facebookMail = "<null>";
fullName = "<null>";
lastLogin = "Thu Apr 07 22:48:37 UTC 2016";
name = Bartek;
objectId = "6DDD9045-B942-84B6-FF14-0C3D8D65A400";
ownerId = "6DDD9045-B942-84B6-FF14-0C3D8D65A400";
showPicture = "<null>";
surname = UchaDski;
updated = "<null>";
"user-token" = "DFD6B74F-B8B0-9510-FF4F-8FE75BB77400";
}
Hi Bartek,
If I understood you correctly, the problem can be reproduced by creating a new facebook account which has never “seen” the Backendless-powered app and login to fb/backendless with that account. On the very first attempt to login, you get a user object which has no properties.
Mark
Exactly. That’s correct. I bypass it by calling easyFacebookLogin again if the received user has nil properties but it is not very elegant as users have to log in twice at first launch and it may be confusing for them.
Thanks, Bartek. I opened an internal ticket # BKNDLSS-12296
Regards,
Mark
Hi,
I just created a simple project with easy FB login, it works fine for me, I shared it. You can try it with my backendless app, then set your appId & secretKey and compare the results. Let me know how it works for you.
Regards,
Slava