ParseAuthentication

public protocol ParseAuthentication : Decodable, Encodable

Objects that conform to the ParseAuthentication protocol provide convenience implementations for using 3rd party authentication methods. The authentication methods supported by the Parse Server can be found here.

  • The type of authentication.

    Declaration

    Swift

    static var __type: String { get }
  • Returns true if the current user is linked to the respective authentication type.

    Declaration

    Swift

    var isLinked: Bool { get }
  • The default initializer for this authentication type.

    Declaration

    Swift

    init()
  • Login a ParseUser asynchronously using the respective authentication type.

    Declaration

    Swift

    func login(authData: [String: String],
               options: API.Options,
               callbackQueue: DispatchQueue,
               completion: @escaping (Result<AuthenticatedUser, ParseError>) -> Void)

    Parameters

    authData

    The authData for the respective authentication type.

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute.

  • Link the current ParseUser asynchronously using the respective authentication type.

    Declaration

    Swift

    func link(authData: [String: String],
              options: API.Options,
              callbackQueue: DispatchQueue,
              completion: @escaping (Result<AuthenticatedUser, ParseError>) -> Void)

    Parameters

    authData

    The authData for the respective authentication type.

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute.

  • isLinked(with:) Default implementation

    Whether the ParseUser is logged in with the respective authentication type.

    Default Implementation

    Declaration

    Swift

    func isLinked(with user: AuthenticatedUser) -> Bool

    Parameters

    user

    The ParseUser to check authentication type. The user must be logged in on this device.

    Return Value

    true if the ParseUser is logged in via the repective authentication type. false if the user is not.

  • Unlink the ParseUser asynchronously from the respective authentication type.

    Default Implementation

    Declaration

    Swift

    func unlink(_ user: AuthenticatedUser,
                options: API.Options,
                callbackQueue: DispatchQueue,
                completion: @escaping (Result<AuthenticatedUser, ParseError>) -> Void)

    Parameters

    user

    The ParseUser to unlink. The user must be logged in on this device.

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute. It should have the following argument signature: (Result<Self, ParseError>).

  • Unlink the current ParseUser asynchronously from the respective authentication type.

    Default Implementation

    Declaration

    Swift

    func unlink(options: API.Options,
                callbackQueue: DispatchQueue,
                completion: @escaping (Result<AuthenticatedUser, ParseError>) -> Void)

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute. It should have the following argument signature: (Result<AuthenticatedUser, ParseError>).

  • strip() Default implementation

    Strips the current user of a respective authentication type.

    Default Implementation

    Declaration

    Swift

    func strip()
  • strip(_:) Default implementation

    Strips the ParseUserof a respective authentication type.

    Default Implementation

    Declaration

    Swift

    func strip(_ user: AuthenticatedUser) -> AuthenticatedUser

    Parameters

    user

    The ParseUser to strip. The user must be logged in on this device.

    Return Value

    The user whose autentication type was stripped. This modified user has not been saved.

Combine

  • Login a ParseUser asynchronously using the respective authentication type. Publishes when complete.

    Declaration

    Swift

    func loginPublisher(authData: [String: String],
                        options: API.Options) -> Future<AuthenticatedUser, ParseError>

    Parameters

    authData

    The authData for the respective authentication type.

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute.

  • Link the current ParseUser asynchronously using the respective authentication type. Publishes when complete.

    Declaration

    Swift

    func linkPublisher(authData: [String: String],
                       options: API.Options) -> Future<AuthenticatedUser, ParseError>

    Parameters

    authData

    The authData for the respective authentication type.

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute.

  • unlinkPublisher(_:options:) Default implementation

    Unlink the ParseUser asynchronously from the respective authentication type. Publishes when complete.

    Default Implementation

    Declaration

    Swift

    func unlinkPublisher(_ user: AuthenticatedUser,
                         options: API.Options) -> Future<AuthenticatedUser, ParseError>

    Parameters

    user

    The ParseUser to unlink. The user must be logged in on this device.

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    completion

    The block to execute. It should have the following argument signature: (Result<Self, ParseError>).

  • unlinkPublisher(options:) Default implementation

    Unlink the current ParseUser asynchronously from the respective authentication type. Publishes when complete.

    Default Implementation

    Declaration

    Swift

    func unlinkPublisher(options: API.Options) -> Future<AuthenticatedUser, ParseError>

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    Return Value

    A publisher that eventually produces a single value and then finishes or fails.

Async/Await

  • Link the current ParseUser asynchronously using the respective authentication type.

    Declaration

    Swift

    func link(authData: [String: String],
              options: API.Options) async throws -> AuthenticatedUser

    Parameters

    authData

    The authData for the respective authentication type.

    options

    A set of header options sent to the server. Defaults to an empty set.

    returns

    An instance of the linked AuthenticatedUser.

  • unlink(_:options:) Default implementation, asynchronous

    Unlink the ParseUser asynchronously from the respective authentication type.

    Default Implementation

    Declaration

    Swift

    func unlink(_ user: AuthenticatedUser,
                options: API.Options) async throws -> AuthenticatedUser

    Parameters

    user

    The ParseUser to unlink. The user must be logged in on this device.

    options

    A set of header options sent to the server. Defaults to an empty set.

    returns

    An instance of the unlinked AuthenticatedUser.

  • unlink(options:) Default implementation, asynchronous

    Unlink the current ParseUser asynchronously from the respective authentication type.

    Default Implementation

    Declaration

    Swift

    func unlink(options: API.Options) async throws -> AuthenticatedUser

    Parameters

    options

    A set of header options sent to the server. Defaults to an empty set.

    callbackQueue

    The queue to return to after completion. Default value of .main.

    returns

    An instance of the unlinked AuthenticatedUser.

Convenience Implementations

  • __type Extension method

    Declaration

    Swift

    var __type: String { get }