I have migrated my iOS app (using Swift) to Parse Server and have integrated Facebook sign-up.
When a new user is created via the Facebook login, a new Session object is not created. Therefore, it does not allow the user to change their profile picture, etc. (when the user tried to update their user info, the error following is error is given:
*[Error]: cannot modify user ********** (Code: 206, Version: 1.14.2)*
Only after the Facebook user logs out and then logs back in again, the Session object is created.
How can I have it so that a Session object is created upon sign up for a new Facebook user so that they may update their user information, just like one is created via the regular standard parse login method?
Here's my code for the Facebook sign up. Note: I use the following method, update the newly created user, and then save the user:
PFFacebookUtils.logInInBackgroundWithReadPermissions(permissions) {
(user: PFUser?, error: NSError?) -> Void in
...
user.email = someEmail
user.username = someUsername
user["profilePicture"] = someFile
...
user.saveInBackgroundWithBlock({
(succeeded: Bool, error: NSError?) -> Void in
...
}
I even tried adding/removing the PFUser.enableRevocableSessionInBackground line of code in my AppDelegate.swift but nothing changed:
// *** Initialize Parse. ***
let config = ParseClientConfiguration(block: {
(ParseMutableClientConfiguration) -> Void in
ParseMutableClientConfiguration.applicationId = appKey;
ParseMutableClientConfiguration.clientKey = clientKey;
ParseMutableClientConfiguration.server = serverURL;
});
Parse.initializeWithConfiguration(config);
PFFacebookUtils.initializeFacebookWithApplicationLaunchOptions(launchOptions)
PFUser.enableRevocableSessionInBackground()