Facebook login
This section explains how you can create an app with user registration using Facebook Login and Parse Server core features through Back4App.
To complete this quickstart, you need:
- An app created at Back4App.
- An iOS app connected to Back4App.
- Note: Follow the Install Parse SDK (ObjC) Tutorial to create an Xcode Project connected to Back4App.
To start using Facebook functions, you need to:
- Add your applicationâs Facebook Application ID on your Parse applicationâs settings page.
- Follow Facebookâs instructions for getting started with the Facebook SDK to create an app linked to the Facebook SDK.
- Find the âFacebook Loginâ block and click on Settings. The âFacebook Loginâ block looks like this:
3. Go back to your XCode Project, open your info.plist copy the code from Facebook Configuration, Step 4a, item 2, and paste it in the <dict>...</dict> part of your info.plist.
4. In order to use a dialog box from Facebook, also copy and paste the code from section 4a, item 3 into your info.plist file.
5. Save
- Add the following to your application:didFinishLaunchingWithOptions: method, after youâve initialized the Parse SDK:
2. Add the following handlers in your app delegate:
ďťżPFUser provides a way to allow your users to log in or sign up through Facebook. This is done by using the logInInBackgroundWithReadPermissions method like so:
When this code is run, the following happens:
- The user is shown the Facebook login dialog.
- The user authenticates via Facebook, and your app receives a callback using handleOpenURLďťż
- Our SDK receives the userâs Facebook access data and saves it to a PFUser. If no PFUser exists with the same Facebook ID, then a new PFUser is created.
- Your code block is called with the user.
- The current user reference will be updated to this user.
The permissions argument is an array of strings that specifies what permissions your app requires from the Facebook user. These permissions must only include read permissions.
To acquire publishing permissions for a user so that your app can, for example, post status updates on their behalf, you must call [PFFacebookUtils logInInBackgroundWithPublishPermissions:]:ďťż
If you want to associate an existing PFUser to a Facebook account, you can link it like so:
If you want to unlink Facebook from a user, simply do this:
ďťż