FlutterAuthManager class
AuthManager for Flutter
This class is used to manage deep linking.
- Inheritance
-
- Object
- APIBase
- AuthManager
- FlutterAuthManager
Constructors
- FlutterAuthManager(AltogicClient client)
Properties
-
authStateChanges
→ Stream<
AuthState> -
AuthState changes stream.
no setterinherited
- currentState → AuthState
-
Current auth state of the user
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
changeEmail(
String currentPassword, String newEmail) → Future< UserResult> -
Changes the email of the user to a new one.
inherited
-
changePassword(
String newPassword, String oldPassword) → Future< APIError?> -
Changes the password of the user.
inherited
-
changePhone(
String currentPassword, String newPhone) → Future< UserResult> -
Changes the phone number of the user to a new one.
inherited
-
clearLocalData(
) → Future< void> -
By default Altogic saves the session and user data in local storage
whenever a new session is created (e.g., through sign up or sign in
methods). This method clears the locally saved session and user data.
In contrast to invalidateSession, this method does not clear
Session token request header in Fetcher and does not redirect
to a sign in page.
inherited
-
getAllSessions(
) → Future< SessionResult> -
Gets all active sessions of a user.
inherited
-
getAuthGrant(
[String? accessToken]) → Future< UserSessionResult> -
getAuthGrant using Flutter
override
-
getSession(
) → Future< Session?> -
Returns the currently active session data from local storage.
inherited
-
getUser(
) → Future< User?> -
Returns the user data from local storage.
inherited
-
getUserFromDB(
) → Future< UserResult> -
Retrieves the user associated with the active session from the database.
inherited
-
invalidateSession(
) → Future< void> -
Invalidates the current user session, removes local session data, and
clears Session token request header in Fetcher.
If signInRedirect is specified in
ClientOptions
when creating the Altogic api client and if the client is running in a browser, redirects the user to the sign in page.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onUserEvent(
UserEventListenerFunction listener) → void -
Registers a method to listen to main user events. The following events
will be listened:
inherited
-
resendVerificationCode(
String phone) → Future< APIError?> -
Resends the code to verify the user's phone number. If the user's phone
has already been validated or phone confirmation is disabled in your
app authentication settings, it returns an error.
inherited
-
resendVerificationEmail(
String email) → Future< APIError?> -
Resends the email to verify the user's email address. If the user's
email has already been validated or email confirmation is disabled
in your app authentication settings, it returns an error.
inherited
-
resetPwdWithCode(
String phone, String code, String newPassword) → Future< APIError?> -
Resets the password of the user using the SMS code provided through the
sendResetPwdCode method.
inherited
-
resetPwdWithToken(
String accessToken, String newPassword) → Future< APIError?> -
Resets the password of the user using the access token provided through
the sendResetPwdEmail flow.
inherited
-
sendMagicLinkEmail(
String email) → Future< APIError?> -
Sends a magic link to the email of the user.
inherited
-
sendResetPwdCode(
String phone) → Future< APIError?> -
Sends an SMS code to reset password.
inherited
-
sendResetPwdEmail(
String email) → Future< APIError?> -
Sends an email with a link to reset password.
inherited
-
sendSignInCode(
String phone) → Future< APIError?> -
Sends an SMS code (OTP - one time password) that can be used to sign in
to the phone number of the user.
inherited
-
setSession(
Session session) → Future< void> -
Sets (overrides) the active user session. If you use the signUp or
signIn methods of this client library, you do not need to call this
method to set the user session, since the client library automatically
manages user session data.
inherited
-
setUser(
User user) → Future< void> -
Saves the user data to local storage. If you use the signUp or signIn
methods of this client library, you do not need to call this method to set
the user data, since the client library automatically manages user data.
inherited
-
signInWithCode(
String phone, String code) → Future< UserSessionResult> -
Log in an existing user using phone number and SMS code (OTP - one time
password) that is sent to the phone. In order to use phone and password
based log in, the authentication provider needs to be Altogic, meaning a
user with phone and password credentials exists in the app database and
sign in using authorization codes needs to be enabled in your app
authentication settings. Before calling this method, you need to call the
sendSignInCode method to get the SMS code delivered to the phone.
inherited
-
signInWithEmail(
String email, String password) → Future< UserSessionResult> -
Log in an existing user using email and password. In order to use email
and password based log in, the authentication provider needs to be
Altogic, meaning a user with email and password credentials exists
in the app database.
inherited
-
signInWithPhone(
String phone, String password) → Future< UserSessionResult> -
Log in an existing user using phone number and password. In order to
use phone and password based log in, the authentication provider
needs to be Altogic, meaning a user with phone and password credentials
exists in the app database.
inherited
-
signInWithProvider(
String provider, [Completer< bool> ? completer]) → String -
Sign in with a provider using Flutter
override
-
signOut(
[String? sessionToken]) → Future< APIError?> -
If an input token is provided, signs out the user from the
current session, clears user and session data in local storage and
removes the Session header in Fetcher. Otherwise, signs out
the user from the session identified by the input token.
inherited
-
signOutAll(
) → Future< APIError?> -
A user can have multiple active sessions (e.g., logged in form multiple
different devices, browsers). This method signs out users from all their
active sessions. For the client that triggers this method, also clears
user and session data in local storage, and removes the Session
header in Fetcher.
inherited
-
signOutAllExceptCurrent(
) → Future< APIError?> -
Signs out users from all their active sessions except the current one
which makes the api call.
inherited
-
signUpWithEmail(
String email, String password, [dynamic nameOrUser]) → Future< UserSessionResult> -
Creates a new user using the email and password authentication
method in the database.
inherited
-
signUpWithPhone(
String phone, String password, [dynamic nameOrUser]) → Future< UserSessionResult> -
Creates a new user using the mobile phone number and password
authentication method in the database.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
verifyPhone(
String phone, String code) → Future< UserSessionResult> -
Verifies the phone number using code sent in SMS and if verified, returns
the auth grants (e.g., user and session data) of the user if the phone is
verified due to a new sign up. If the phone is verified using the code
send as a result of calling the changePhone method, returns the updated
user data only.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited