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 resultAuthSignUpResult.userConfirmed
.Declaration
Swift
@discardableResult func signUp(username: String, password: String?, options: AuthSignUpOperation.Request.Options?, listener: AuthSignUpOperation.ResultListener?) -> AuthSignUpOperation
Parameters
username
username to signUp
password
password as per the password policy of the provider
options
Parameters specific to plugin behavior
listener
Triggered when the operation completes.
-
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
orresendSignUpCode
may cause an error.Declaration
Swift
@discardableResult func confirmSignUp(for username: String, confirmationCode: String, options: AuthConfirmSignUpOperation.Request.Options?, listener: AuthConfirmSignUpOperation.ResultListener?) -> AuthConfirmSignUpOperation
Parameters
username
Username used that was used to signUp.
confirmationCode
Confirmation code received to the user.
options
Parameters specific to plugin behavior
listener
Triggered when the operation completes.
-
Resends the confirmation code to confirm the signUp process
Declaration
Swift
@discardableResult func resendSignUpCode(for username: String, options: AuthResendSignUpCodeOperation.Request.Options?, listener: AuthResendSignUpCodeOperation.ResultListener?) -> AuthResendSignUpCodeOperation
Parameters
username
Username of the user to be confirmed.
options
Parameters specific to plugin behavior.
listener
Triggered when the operation completes.
-
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 passwordcould be nil.
Declaration
Swift
@discardableResult func signIn(username: String?, password: String?, options: AuthSignInOperation.Request.Options?, listener: AuthSignInOperation.ResultListener?) -> AuthSignInOperation
Parameters
username
Username to signIn the user
password
Password to signIn the user
options
Parameters specific to plugin behavior
listener
Triggered when the operation completes.
-
SignIn using pre configured web UI.
Calling this method will always launch the Auth plugin’s default web user interface
Declaration
Swift
@discardableResult func signInWithWebUI(presentationAnchor: AuthUIPresentationAnchor, options: AuthWebUISignInOperation.Request.Options?, listener: AuthWebUISignInOperation.ResultListener?) -> AuthWebUISignInOperation
Parameters
presentationAnchor
Anchor on which the UI is presented.
options
Parameters specific to plugin behavior.
listener
Triggered when the operation completes.
-
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
@discardableResult func signInWithWebUI(for authProvider: AuthProvider, presentationAnchor: AuthUIPresentationAnchor, options: AuthSocialWebUISignInOperation.Request.Options?, listener: AuthSocialWebUISignInOperation.ResultListener?) -> AuthSocialWebUISignInOperation
Parameters
authProvider
Auth provider used to signIn.
presentationAnchor
Anchor on which the UI is presented.
options
Parameters specific to plugin behavior.
listener
Triggered when the operation completes.
-
Confirms a next step in signIn flow.
Declaration
Swift
@discardableResult func confirmSignIn(challengeResponse: String, options: AuthConfirmSignInOperation.Request.Options?, listener: AuthConfirmSignInOperation.ResultListener?) -> AuthConfirmSignInOperation
Parameters
challengeResponse
Challenge response required to confirm the next step in signIn flow
options
Parameters specific to plugin behavior.
listener
Triggered when the operation completes.
-
Sign out the currently logged-in user.
Declaration
Swift
@discardableResult func signOut(options: AuthSignOutOperation.Request.Options?, listener: AuthSignOutOperation.ResultListener?) -> AuthSignOutOperation
Parameters
options
Parameters specific to plugin behavior.
listener
Triggered when the operation completes.
Return Value
AuthSignOutOperation
-
Delete the account of the currently logged-in user.
Declaration
Swift
@discardableResult func deleteUser(listener: AuthDeleteUserOperation.ResultListener?) -> AuthDeleteUserOperation
Parameters
listener
Triggered when the operation completes.
Return Value
AuthDeleteUserOperation
-
Fetch the current authentication session.
Declaration
Swift
@discardableResult func fetchAuthSession(options: AuthFetchSessionOperation.Request.Options?, listener: AuthFetchSessionOperation.ResultListener?) -> AuthFetchSessionOperation
Parameters
options
Parameters specific to plugin behavior
listener
Triggered when the operation completes.
-
Initiate a reset password flow for the user
Declaration
Swift
@discardableResult func resetPassword(for username: String, options: AuthResetPasswordOperation.Request.Options?, listener: AuthResetPasswordOperation.ResultListener?) -> AuthResetPasswordOperation
Parameters
username
username whose password need to reset
options
Parameters specific to plugin behavior
listener
Triggered when the operation completes
-
Confirms a reset password flow
Declaration
Swift
@discardableResult func confirmResetPassword(for username: String, with newPassword: String, confirmationCode: String, options: AuthConfirmResetPasswordOperation.Request.Options?, listener: AuthConfirmResetPasswordOperation.ResultListener?) -> AuthConfirmResetPasswordOperation
Parameters
username
username whose password need to reset
newPassword
new password for the user
confirmationCode
Received confirmation code
options
Parameters specific to plugin behavior
listener
Triggered when the operation completes
-
signUp(username:
Extension methodpassword: options: ) 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 resultAuthSignUpResult.userConfirmed
.Declaration
Swift
func signUp( username: String, password: String? = nil, options: AuthSignUpOperation.Request.Options? = nil ) -> AuthSignUpOperation
Parameters
username
username to signUp
password
password as per the password policy of the provider
options
Parameters specific to plugin behavior
-
confirmSignUp(for:
Extension methodconfirmationCode: options: ) 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
orresendSignUpCode
may cause an error.Declaration
Swift
func confirmSignUp( for username: String, confirmationCode: String, options: AuthConfirmSignUpOperation.Request.Options? = nil ) -> AuthConfirmSignUpOperation
Parameters
username
Username used that was used to signUp.
confirmationCode
Confirmation code received to the user.
options
Parameters specific to plugin behavior
-
resendSignUpCode(for:
Extension methodoptions: ) Resends the confirmation code to confirm the signUp process
Declaration
Swift
func resendSignUpCode( for username: String, options: AuthResendSignUpCodeOperation.Request.Options? = nil ) -> AuthResendSignUpCodeOperation
Parameters
username
Username of the user to be confirmed.
options
Parameters specific to plugin behavior.
-
signIn(username:
Extension methodpassword: 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 passwordcould be nil.
Declaration
Swift
func signIn( username: String? = nil, password: String? = nil, options: AuthSignInOperation.Request.Options? = nil ) -> AuthSignInOperation
Parameters
username
Username to signIn the user
password
Password to signIn the user
options
Parameters specific to plugin behavior
-
signInWithWebUI(presentationAnchor:
Extension methodoptions: ) 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: AuthWebUISignInOperation.Request.Options? = nil ) -> AuthWebUISignInOperation
Parameters
presentationAnchor
Anchor on which the UI is presented.
options
Parameters specific to plugin behavior.
-
signInWithWebUI(for:
Extension methodpresentationAnchor: 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: AuthSocialWebUISignInOperation.Request.Options? = nil ) -> AuthSocialWebUISignInOperation
Parameters
authProvider
Auth provider used to signIn.
presentationAnchor
Anchor on which the UI is presented.
options
Parameters specific to plugin behavior.
-
confirmSignIn(challengeResponse:
Extension methodoptions: ) Confirms a next step in signIn flow.
Declaration
Swift
func confirmSignIn( challengeResponse: String, options: AuthConfirmSignInOperation.Request.Options? = nil ) -> AuthConfirmSignInOperation
Parameters
challengeResponse
Challenge response required to confirm the next step in signIn flow
options
Parameters specific to plugin behavior.
-
signOut(options:
Extension method) Declaration
Swift
func signOut( options: AuthSignOutOperation.Request.Options? = nil ) -> AuthSignOutOperation
-
deleteUser()
Extension methodDelete the account of the currently logged-in user.
Declaration
Swift
@discardableResult func deleteUser() -> AuthDeleteUserOperation
Return Value
AuthDeleteUserOperation
-
fetchAuthSession(options:
Extension method) Fetch the current authentication session.
Declaration
Swift
func fetchAuthSession( options: AuthFetchSessionOperation.Request.Options? = nil ) -> AuthFetchSessionOperation
Parameters
options
Parameters specific to plugin behavior
-
resetPassword(for:
Extension methodoptions: ) Initiate a reset password flow for the user
Declaration
Swift
func resetPassword( for username: String, options: AuthResetPasswordOperation.Request.Options? = nil ) -> AuthResetPasswordOperation
Parameters
username
username whose password need to reset
options
Parameters specific to plugin behavior
-
confirmResetPassword(for:
Extension methodwith: confirmationCode: options: ) Confirms a reset password flow
Declaration
Swift
func confirmResetPassword( for username: String, with newPassword: String, confirmationCode: String, options: AuthConfirmResetPasswordOperation.Request.Options? = nil ) -> AuthConfirmResetPasswordOperation
Parameters
username
username whose password need to reset
newPassword
new password for the user
confirmationCode
Received confirmation code
options
Parameters specific to plugin behavior