Facebook integration

What's happening:

I have a server server where I have the information of each individual user. Authentication of Twitter and Facebook is a common way to allow a user to access one of the applications at the moment, so it was decided that he / she would have to use these platforms + the classic way (email address + password)

Question:

After the user has logged in using Facebook, and I get a callback saying that it was successful (for example, with the SDK):

- (void)sessionStateChanged:(FBSession *)session state:(FBSessionState) state error:(NSError *)error { switch (state) { case FBSessionStateOpen: if (!error) { // We have a valid session NSLog(@"User session found"); } break; case FBSessionStateClosed: case FBSessionStateClosedLoginFailed: [FBSession.activeSession closeAndClearTokenInformation]; break; default: break; } 
  • How can I transfer credentials to a server so that we can access our own endpoints?

  • How does the backend know that this particular user creating the request is actually authenticated (or registered) in your backend?

  • What role do we create on Facebook? ( https://developers.facebook.com/apps/ ) in this?

+7
source share
1 answer
  • You can get the OAuth token using FBSession.activeSession.accessToken
  • I assume that you save the emails of all registered users. You can get user information using: -[FBRequestConnection startForMeWithCompletionHandler:] . This will return an instance of FBGraphUser that contains the email / name among other details.
  • Your FB application does not really play a big role in this process. A description of the application and icon will be displayed when the FB asks the user for permission. And if you post anything in the user's feed, a small icon is displayed. You can link your FB application page to your site.
+2
source

All Articles