AuthCategoryBehavior
public protocol AuthCategoryBehavior : AuthCategoryDeviceBehavior, AuthCategoryUserBehavior, AuthCategoryWebAuthnBehaviour
Behavior of the Auth category that clients will use
-
signUp(username:Asynchronouspassword: options: ) SignUp a user with the authentication provider.
If the signUp require multiple steps like passing a confirmation code, use the method
confirmSignUpafter this api completes. You can check if the user is confirmed or not using the resultAuthSignUpResult.userConfirmed.Declaration
Swift
func signUp( username: String, password: String?, options: AuthSignUpRequest.Options? ) async throws -> AuthSignUpResultParameters
usernameusername to signUp
passwordpassword as per the password policy of the provider
optionsParameters specific to plugin behavior
-
confirmSignUp(for:AsynchronousconfirmationCode: options: ) Confirms the
signUpoperation.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
signUporresendSignUpCodemay cause an error.Declaration
Swift
func confirmSignUp( for username: String, confirmationCode: String, options: AuthConfirmSignUpRequest.Options? ) async throws -> AuthSignUpResultParameters
usernameUsername used that was used to signUp.
confirmationCodeConfirmation code received to the user.
optionsParameters specific to plugin behavior
-
resendSignUpCode(for:Asynchronousoptions: ) Resends the confirmation code to confirm the signUp process
Declaration
Swift
func resendSignUpCode( for username: String, options: AuthResendSignUpCodeRequest.Options? ) async throws -> AuthCodeDeliveryDetailsParameters
usernameUsername of the user to be confirmed.
optionsParameters specific to plugin behavior.
-
signIn(username:Asynchronouspassword: options: ) 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 -> AuthSignInResultParameters
usernameUsername to signIn the user
passwordPassword to signIn the user
optionsParameters specific to plugin behavior
-
signInWithWebUI(presentationAnchor:Asynchronousoptions: ) 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 -> AuthSignInResultParameters
presentationAnchorAnchor on which the UI is presented.
optionsParameters specific to plugin behavior.
-
signInWithWebUI(for:AsynchronouspresentationAnchor: options: ) 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 -> AuthSignInResultParameters
authProviderAuth provider used to signIn.
presentationAnchorAnchor on which the UI is presented.
optionsParameters specific to plugin behavior.
-
confirmSignIn(challengeResponse:Asynchronousoptions: ) Confirms a next step in signIn flow.
Declaration
Swift
func confirmSignIn( challengeResponse: String, options: AuthConfirmSignInRequest.Options? ) async throws -> AuthSignInResultParameters
challengeResponseChallenge response required to confirm the next step in signIn flow
optionsParameters specific to plugin behavior.
-
autoSignIn()AsynchronousAuto signs in the user for passwordless sign up
Declaration
Swift
func autoSignIn() async throws -> AuthSignInResult -
signOut(options:Asynchronous) Sign out the currently logged-in user.
Declaration
Swift
func signOut(options: AuthSignOutRequest.Options?) async -> AuthSignOutResultParameters
optionsParameters specific to plugin behavior.
-
deleteUser()AsynchronousDelete the account of the currently logged-in user.
Declaration
Swift
func deleteUser() async throws -
fetchAuthSession(options:Asynchronous) Fetch the current authentication session.
Declaration
Swift
func fetchAuthSession(options: AuthFetchSessionRequest.Options?) async throws -> AuthSessionParameters
optionsParameters specific to plugin behavior
-
resetPassword(for:Asynchronousoptions: ) Initiate a reset password flow for the user
Declaration
Swift
func resetPassword( for username: String, options: AuthResetPasswordRequest.Options? ) async throws -> AuthResetPasswordResultParameters
usernameusername whose password need to reset
optionsParameters 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 throwsParameters
usernameusername whose password need to reset
newPasswordnew password for the user
confirmationCodeReceived confirmation code
optionsParameters specific to plugin behavior
-
setUpTOTP()AsynchronousInitiates 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 -
verifyTOTPSetup(code:Asynchronousoptions: ) 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 throwsParameters
codeverification code from the associated Authenticator app
optionsParameters specific to plugin behavior
View on GitHub