FacebookTokenProfile

public struct FacebookTokenProfile: TypeSafeFacebookToken

A pre-constructed TypeSafeFacebookToken which contains the default fields plus examples of optional fields that can be requested from Facebook. See: https://developers.facebook.com/docs/facebook-login/permissions/v3.0#reference-default_fields

Note that the Optional fields will only be initialized if the user’s OAuth token grants access to the data, and many extended permissions require a Facebook app review prior to that app being allowed to request them.

Usage Example:

FacebookTokenProfile.appID = "yourAppID"
router.get("/facebookProfile") { (user: FacebookTokenProfile, respondWith: (FacebookTokenProfile?, RequestError?) -> Void) in
   respondWith(user, nil)
}
  • The OAuth client id (‘AppID’) that tokens should correspond to. This value must be set to match the Facebook OAuth app that was used to issue the token. Tokens that are received but that do not match this value will be rejected.

    When using the default FacebookTokenProfile, your application must set this value prior to use:

        FacebookTokenProfile.appID = "<your OAuth client id>"
    

    Declaration

    Swift

    public static var appID: String?
  • id

    The application-scoped ID field. Note that this field uniquely identifies a user wihin the context of the application represented by the token.

    Declaration

    Swift

    public let id: String
  • The subject’s display name.

    Declaration

    Swift

    public let name: String
  • Metadata allowing access to the subject’s profile picture.

    Declaration

    Swift

    public let picture: FacebookPicture
  • The subject’s first name.

    Declaration

    Swift

    public let first_name: String
  • The subject’s last name.

    Declaration

    Swift

    public let last_name: String
  • The subject’s chosen name format, e.g.: "{first} {last}".

    Declaration

    Swift

    public let name_format: String
  • The subject’s chosen short name.

    Declaration

    Swift

    public let short_name: String
  • The subject’s middle name.

    Declaration

    Swift

    public let middle_name: String?
  • The subject’s e-mail address.

    Declaration

    Swift

    public let email: String?
  • The subject’s age range.

    Declaration

    Swift

    public let age_range: FacebookAgeRange?
  • The subject’s birthday, in the format MM/DD/YYYY.

    Declaration

    Swift

    public let birthday: String?
  • Information on the subject’s friends. Note that only friends of this user that have also granted this permission to the same OAuth application will be detailed.

    Declaration

    Swift

    public let friends: FacebookFriends?
  • The subject’s gender.

    Declaration

    Swift

    public let gender: String?
  • Information about the subject’s home town.

    Declaration

    Swift

    public let hometown: FacebookPage?
  • Information about items the subject has ‘liked’.

    Declaration

    Swift

    public let likes: FacebookLikes?
  • A link to the subject’s profile for another user of the app.

    Declaration

    Swift

    public let link: String?
  • The subject’s location (current city) as specified on their profile.

    Declaration

    Swift

    public let location: FacebookPage?
  • Metadata about the subject’s photos, which can be used to access the photos via the User API: https://developers.facebook.com/docs/graph-api/reference/user/photos

    Declaration

    Swift

    public let photos: FacebookPhotos?
  • Data from the subject’s timeline, including posts they have created and been tagged in.

    Declaration

    Swift

    public let posts: FacebookPosts?
  • A list of places that the subject has been tagged at.

    Declaration

    Swift

    public let tagged_places: FacebookTaggedPlaces?