The below code adds the parse login and signup forms. But when I use the Facebook fields, it logs in the user but it does not update the email fields.
Is there a way I can get the email field updated?
func showLogInPage() {
var loginViewController = PFLogInViewController()
loginViewController.delegate = self
loginViewController.fields = (PFLogInFields.UsernameAndPassword | PFLogInFields.LogInButton | PFLogInFields.SignUpButton | PFLogInFields.PasswordForgotten | PFLogInFields.Facebook)
var signupViewController = PFSignUpViewController()
signupViewController.delegate = self
loginViewController.signUpController = signupViewController
self.presentViewController(loginViewController, animated: true, completion: nil)
}
Inside of the
PFLogInViewControllerDelegate
there is a callback which is triggered when logging in with Facebook calledlogInViewController:didLogInUser
. In here you can retrieve the email from the Facebook SDK and store it in thePFUser
. I've made a small example here:UPDATE 1
Missing the FB permission settings
You need to specify the Facebook permission in your
showLogInPage
to read the user's email. You can do this in the following way: