Protocols

The following protocols are available globally.

  • A protocol that defines common attributes of Facebook authentication methods.

    It is not intended for a user’s type to conform to this protocol directly. Instead, your type should conform to a specific authentication type, such as TypeSafeFacebookToken.

    See more

    Declaration

    Swift

    public protocol TypeSafeFacebook: TypeSafeCredentials
  • A protocol that a user’s type can conform to representing a user authenticated using a Facebook OAuth token.

    Usage Example:

    public struct ExampleProfile: TypeSafeFacebookToken {
       static var appID: String? = "yourAppID"     // The id of your Facebook App
       let id: String                              // Protocol requirement
       let name: String                            // Protocol requirement: subject's display name
       let email: String?                          // Optional Facebook field: may not be granted
    }
    router.get("/facebookProfile") { (user: ExampleProfile, respondWith: (ExampleProfile?, RequestError?) -> Void) in
       respondWith(user, nil)
    }
    

    A pre-defined FacebookTokenProfile type has been provided for use if you do not wish to define your own type, and provides an example of how to access the various structured data types (such as profile picture information) provided by the Facebook API.

    See more

    Declaration

    Swift

    public protocol TypeSafeFacebookToken: TypeSafeFacebook