Start a new topic

Logging in via Facebook failing

I am trying to create a user in Kinvey using Facebook, but it doesn't seem to be doing anything. I use the following code to login via Facebook:



mKinveyClient.user().loginFacebookBlocking(accessToken);



I know the access token is correct since I can access data directly from my Facebook account. After I login I check the user to see if the users data has been updated, but it is just empty: "{}". Later on in the code I try to save some parameters to the user using "user.put(key , value)" and after that I call



user.updateBlocking().execute();



but I get a Nullpointer exception: "No Active User - please login a user by calling myClient.user().login( ... ) before retrying this request." Which doesn't make sense since I have not signed the user out and the user is not null. Is there something that I am missing?



1 Comment

For the blocking API, you have to call `execute()` on all methods--



so instead of:



mKinveyClient.user().loginFacebookBlocking(accessToken);



it would be:



mKinveyClient.user().loginFacebookBlocking(accessToken).execute();



Also, note that the execute method returns an object, so you could actually do:



User currentUser = mKinveyClient.user().loginFacebookBlocking(accessToken).execute();
Login or Signup to post a comment