Backendless Support
 
Answered

socialAccount property not retrieved

I'm having troubles with getting socialAccount property from BackendlessUser on the client side. When I get successful login callback from loginWithGooglePlusSdk there is no socialAccount provided in properties HashMap.

What should I do in order to get that property. Am I missing something?

3c21c378c7ca33fd34a2d6d7c600d2b5

Leave a Comment

Comments (6)

photo
1

I am curious.. what do you expect to get in that property? Why does the app even need it?

photo
1

Well in Backendless console there is a reserved column socialAccount in User table so I was expecting that I will get it along other User table properties. App will have to store it so that we can distinguish between Google and Facebook login :)

photo
1

If you were to get the user object this way, then the socialAccount property is there:

  1. String userObjectId = "E0C5CDBC-02CF-FD44-FF85-956570596900";
  2. Backendless.Data.of( BackendlessUser.class ).findById( userObjectId, new AsyncCallback<BackendlessUser>()
  3. {
  4. @Override
  5. public void handleResponse( BackendlessUser user )
  6. {
  7. Log.i( "MY APP", user.getProperty( "socialAccount" ));
  8. }
  9. @Override
  10. public void handleFault( BackendlessFault fault )
  11. {
  12. }
  13. } );

Otherwise, for the object you get from the login, you'd know whether it is a google or facebook user, since the login calls for those systems are different, right?

Regards,

Mark

photo
1

Otherwise, for the object you get from the login, you'd know whether it is a google or facebook user, since the login calls for those systems are different, right?

Yes, I agree. I decided to store social account in that way, definitely simpler than doing another async call. Thanks Mark!

photo
1

"Otherwise, for the object you get from the login, you'd know whether it is a google or facebook user, since the login calls for those systems are different, right?"

Yes, if we call login after every app launch, but if you would like to use auto-login (like in my case), then you know nothing about the type of the login. Why I have to know it? Because I would like to disable the password changing if the user has logged in with Facebook. Btw yes, I could solve it, if I manage an offline database with userId-socialAccount entries, where I can store the login type at the first login, but since Backendless already stores this value, I think it would be more elegant if we can simply read it.

photo
1

Hi I'm having the same issue. The weird thing is that I was able to get the property last week. "socialAccount".

I too need it to stop users changing password as it's not allowed.

For now I'm using

static var isSocialAccount: Bool {

return FBSDKAccessToken.currentAccessToken() != nil

}