AuthCategoryBehavior

public protocol AuthCategoryBehavior : AuthCategoryDeviceBehavior, AuthCategoryUserBehavior

Behavior of the Auth category that clients will use

  • SignUp a user with the authentication provider.

    If the signUp require multiple steps like passing a confirmation code, use the method confirmSignUp after this api completes. You can check if the user is confirmed or not using the result AuthSignUpResult.userConfirmed.

    Declaration

    Swift

    func signUp(
        username: String,
        password: String?,
        options: AuthSignUpRequest.Options?
    ) async throws -> AuthSignUpResult

    Parameters

    username

    username to signUp

    password

    password as per the password policy of the provider

    options

    Parameters specific to plugin behavior

  • Confirms the signUp operation.

    Invoke this operation as a follow up for the signUp process if the authentication provider that you are using required to follow a next step after signUp. Calling this operation without first calling signUp or resendSignUpCode may cause an error.

    Declaration

    Swift

    func confirmSignUp(for username: String,
                       confirmationCode: String,
                       options: AuthConfirmSignUpRequest.Options?) async throws -> AuthSignUpResult

    Parameters

    username

    Username used that was used to signUp.

    confirmationCode

    Confirmation code received to the user.

    options

    Parameters specific to plugin behavior

  • Resends the confirmation code to confirm the signUp process

    Declaration

    Swift

    func resendSignUpCode(
        for username: String,
        options: AuthResendSignUpCodeRequest.Options?
    ) async throws -> AuthCodeDeliveryDetails

    Parameters

    username

    Username of the user to be confirmed.

    options

    Parameters specific to plugin behavior.

  • SignIn to the authentication provider

    Username and password are optional values, check the plugin documentation to decide on what all values need to passed. For example in a passwordless flow you just need to pass the username and the password could be nil.

    Declaration

    Swift

    func signIn(username: String?,
                password: String?,
                options: AuthSignInRequest.Options?) async throws -> AuthSignInResult

    Parameters

    username

    Username to signIn the user

    password

    Password to signIn the user

    options

    Parameters specific to plugin behavior

  • SignIn using pre configured web UI.

    Calling this method will always launch the Auth plugin’s default web user interface

    Declaration

    Swift

    func signInWithWebUI(presentationAnchor: AuthUIPresentationAnchor?,
                         options: AuthWebUISignInRequest.Options?) async throws -> AuthSignInResult

    Parameters

    presentationAnchor

    Anchor on which the UI is presented.

    options

    Parameters specific to plugin behavior.

  • SignIn using an auth provider on a web UI

    Calling this method will invoke the AuthProvider’s default web user interface. Depending on the plugin implementation and the authentication state with the provider, this method might complete without showing any UI.

    Declaration

    Swift

    func signInWithWebUI(for authProvider: AuthProvider,
                         presentationAnchor: AuthUIPresentationAnchor?,
                         options: AuthWebUISignInRequest.Options?) async throws -> AuthSignInResult

    Parameters

    authProvider

    Auth provider used to signIn.

    presentationAnchor

    Anchor on which the UI is presented.

    options

    Parameters specific to plugin behavior.

  • Confirms a next step in signIn flow.

    Declaration

    Swift

    func confirmSignIn(
        challengeResponse: String,
        options: AuthConfirmSignInRequest.Options?
    ) async throws -> AuthSignInResult

    Parameters

    challengeResponse

    Challenge response required to confirm the next step in signIn flow

    options

    Parameters specific to plugin behavior.

  • signOut(options:) Asynchronous

    Sign out the currently logged-in user.

    Declaration

    Swift

    func signOut(options: AuthSignOutRequest.Options?) async -> AuthSignOutResult

    Parameters

    options

    Parameters specific to plugin behavior.

  • deleteUser() Asynchronous

    Delete the account of the currently logged-in user.

    Declaration

    Swift

    func deleteUser() async throws
  • Fetch the current authentication session.

    Declaration

    Swift

    func fetchAuthSession(options: AuthFetchSessionRequest.Options?) async throws -> AuthSession

    Parameters

    options

    Parameters specific to plugin behavior

  • Initiate a reset password flow for the user

    Declaration

    Swift

    func resetPassword(for username: String,
                       options: AuthResetPasswordRequest.Options?) async throws -> AuthResetPasswordResult

    Parameters

    username

    username whose password need to reset

    options

    Parameters specific to plugin behavior

  • Confirms a reset password flow

    Declaration

    Swift

    func confirmResetPassword(
        for username: String,
        with newPassword: String,
        confirmationCode: String,
        options: AuthConfirmResetPasswordRequest.Options?
    ) async throws

    Parameters

    username

    username whose password need to reset

    newPassword

    new password for the user

    confirmationCode

    Received confirmation code

    options

    Parameters specific to plugin behavior

  • setUpTOTP() Asynchronous

    Initiates TOTP Setup

    Invoke this operation to setup TOTP for the user while signed in. Calling this method will initiate TOTP setup process and returns a shared secret that can be used to generate QR code. The setup details also contains a URI generator helper that can be used to retireve a TOTP Setup URI.

    Declaration

    Swift

    func setUpTOTP() async throws -> TOTPSetupDetails
  • Verifies TOTP Setup

    Invoke this operation to verify TOTP setup for the user while signed in. Calling this method with the verification code from the associated Authenticator app will complete the TOTP setup process.

    Declaration

    Swift

    func verifyTOTPSetup(
        code: String,
        options: VerifyTOTPSetupRequest.Options?
    ) async throws

    Parameters

    code

    verification code from the associated Authenticator app

    options

    Parameters specific to plugin behavior