Facebook Developers
DocsToolsSupportNewsApps
Log In
  • Social Plugins
  • Facebook Login
  • Open Graph
  • Facebook APIs
  • Games
  • Media
  • Payments
  • App Center
  • Promote Your App
  • iOS
  • Android
  • Web
  • Technology Partners
  • Methods
    • Authentication
    • Dialog
    • Request
  • Protocols
    • FBDialogDelegate
    • FBRequestDelegate
    • FBSessionDelegate

FBSessionDelegate

The FBSessionDelegate protocol defines the methods that a delegate of a Facebook object may implement. The methods are defined in Facebook.h.

The protocol declares methods that are implemented by your application to handle session callbacks during user authentication and permissions authorization. All the methods defined in this protocol are required.

You should implement the methods to handle one or more of the following scenarios:

  • User successfully logs in.

  • User successfully logs out.

  • User dismisses the authorization dialog during the login process.

  • An error occurs during the authorization process.

  • The access_token has been refreshed.

  • The current user session has expired during an API call.

Instance Methods


fbDidLogin

Sent to the delegate when the user successfully logs in.

- (void)fbDidLogin;

Parameters

None

Notes

You will want to handle any post-login set up in your implementation. For example you could store the user's access_token in persistent storage.


fbDidNotLogin:

Sent to the delegate when there is an error during authorization or if the user dismissed the dialog without logging in.

- (void)fbDidNotLogin:(BOOL)cancelled;

Parameters

cancelled - If the authorization failed due to user action.

Notes

You will want to handle the authorization dismissals and failures in your implementation.


fbDidLogout

Sent to the delegate when the user logged out.

- (void)fbDidLogout;

Parameters

None

Notes

You will want to handle any post-logout set up in your implementation. For example, you could remove the user's access_token from persistent storage if you previously stored this upon successful login.


fbDidExtendToken:expiresAt:

Sent to the delegate when the access token is extended.

- (void)fbDidExtendToken:(NSString*)accessToken
           expiresAt:(NSDate*)expiresAt;

Parameters

accessToken - The extended access_token.

expiresAt - The updated expiration date.

Notes

Implement this method to refresh any previously stored access_token in your app. For example, if you stored the session information in persistent storage you will need to update that information.


fbSessionInvalidated

Sent to the delegate when Facebook Platform is invoked and the current user session has expired.

- (void)fbSessionInvalidated;

Parameters

None

Notes

You could implement this method and perhaps alert the user then invite them to re-authenticate your app.

Updated over a year ago
Facebook © 2013 · English (US)
AboutAdvertisingCareersPlatform PoliciesPrivacy Policy