CredentialsFacebookToken

public class CredentialsFacebookToken : CredentialsPluginProtocol

Authentication using Facebook OAuth token.

  • The name of the plugin.

    Declaration

    Swift

    public var name: String { get }
  • An indication as to whether the plugin is redirecting or not.

    Declaration

    Swift

    public var redirecting: Bool { get }
  • The time in seconds since the user profile was generated that the access token will be considered valid.

    Declaration

    Swift

    public let tokenTimeToLive: TimeInterval?
  • User profile cache.

    Declaration

    Swift

    public var usersCache: NSCache<NSString, BaseCacheElement>?
  • A delegate for UserProfile manipulation.

    Declaration

    Swift

    public var userProfileDelegate: UserProfileDelegate? { get }
  • Initialize a CredentialsFacebookToken instance.

    Declaration

    Swift

    public init(options: [String : Any]? = nil, tokenTimeToLive: TimeInterval? = nil)

    Parameters

    options

    A dictionary of plugin specific options. The keys are defined in CredentialsFacebookOptions.

    tokenTimeToLive

    The time in seconds since the user profile was generated that the access token will be considered valid.

  • Authenticate incoming request using Facebook OAuth token.

    Declaration

    Swift

    public func authenticate(request: RouterRequest, response: RouterResponse,
                             options: [String:Any], onSuccess: @escaping (UserProfile) -> Void,
                             onFailure: @escaping (HTTPStatusCode?, [String:String]?) -> Void,
                             onPass: @escaping (HTTPStatusCode?, [String:String]?) -> Void,
                             inProgress: @escaping () -> Void)

    Parameters

    request

    The RouterRequest object used to get information about the request.

    response

    The RouterResponse object used to respond to the request.

    options

    The dictionary of plugin specific options.

    onSuccess

    The closure to invoke in the case of successful authentication.

    onFailure

    The closure to invoke in the case of an authentication failure.

    onPass

    The closure to invoke when the plugin doesn’t recognize the authentication token in the request.

    inProgress

    The closure to invoke to cause a redirect to the login page in the case of redirecting authentication.