Authenticator

public protocol Authenticator

Interface for authentication actions like login and logout.

  • Performs the login operation.

    Declaration

    Swift

    func authenticate(presentingViewController: UIViewController, onCompleted: @escaping (_ user: User?, _ error: Error?) -> Void)

    Parameters

    presentingViewController

    the view controller

    onCompleted

    callback function that is invoked when the login is completed

    user

    the user returned in the onCompleted callback function. Will be nil if authentication failed

    error

    the error returned in the onCompleted callback function. Will be nil if authentication was successful

  • Resumes the login operation.

    Declaration

    Swift

    func resumeAuth(url: URL) -> Bool

    Parameters

    url

    the redirect url used to redirect back to the app after a login attempt via the device browser

    Return Value

    true if the login action can be resumed, false otherwise

  • Performs the logout operation.

    Declaration

    Swift

    func logout(currentUser: User, onCompleted: @escaping (_ error: Error?) -> Void)

    Parameters

    currentUser

    the user to be logged out

    onCompleted

    callback function that is invoked when the logout is completed

    error

    the error returned in the onCompleted callback function. Will be nil if login was successful