User de-selects Facebook permission while logging in with PFFacebookUtils

22 Views Asked by At

I've been searching and trying to solve this issue with PFFacebookUtils and Parse, where the user logs in through Facebook but doesn't get saved in Parse Data Browser. Within this processes the user de-selects a permission (eg. email) and this results in an empty User in Parse Data Browser.

I have changed this processes and added some checks:

  • Checking if permissions are given, if not then re-asks for permission.
  • Everytime a new PFUser is created, so if permissions is not given, then the process starts over and I delete the old PFUser (so a new one is created).
  • When all the permissions is in check and the data is ready to be saved to Parse it fails, and the user object shows up with no information in Parse.

Anyone experienced something similar to this? Empty PFUser data in Data Browser when logging in with Facebook?

Using PFFacebookUtils.logInWithPermissions

1

There are 1 best solutions below

0
On

This could happen but you can prevent an user being created in your Parse User class by checking it on Cloud. In your User class beforesave trigger, you can easily detect if a user being signed up is a Facebook user or not by looking at request.object.get("authData"). Then you can use the access token (request.object.get("authData").facebook.access_token) to call the graph API and check if your user has granted all the permissions you require:

https://graph.facebook.com/me/permissions&access_token=xxx

If not, you reject the user record by returning response.error().