BetterAuthClient<T extends User> class

Create a better auth client

Constructors

BetterAuthClient.new({required String baseUrl, required TokenStore tokenStore, String? scheme, T fromJsonUser(Map<String, dynamic>)?, List<BasePlugin<T>>? customPlugins})

Properties

admin AdminPlugin<T>
The Admin plugin
latefinal
apiKey ApiKeyPlugin
The API Key plugin
latefinal
baseUrl String
The base url where your better auth is running. Do not add trailing slash.
final
emailOtp EmailOtpPlugin<T>
The email OTP plugin
latefinal
hashCode int
The hash code for this object.
no setterinherited
The magic link plugin
latefinal
oneTimeToken OneTimeTokenPlugin<T>
The One-Time Token (OTT) plugin provides functionality to generate and verify secure, single-use session tokens. These are commonly used for across domains authentication.
latefinal
organization OrganizationPlugin
The Organization plugin
latefinal
phoneNumber PhoneNumberPlugin<T>
The phone number plugin
latefinal
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scheme String?
The Deep Link scheme of your app This will be used to open the callback urls
getter/setter pair
signIn ↔ Signin<T>
The signin object
latefinal
signUp ↔ Signup<T>
The signup object
latefinal
tokenStore TokenStore
The token store to save and retrieve the token.
final
twoFactor TwoFactorPlugin<T>
Two-Factor Authentication (2FA) plugin.
latefinal

Methods

changeEmail({required String newEmail, String? callbackURL}) Future<BaseResponseWithMessage>
Change the email of the user.
changePassword({required String newPassword, required String currentPassword, bool? revokeOtherSessions = false}) Future<ChangePasswordResponse>
Change the password of the user.
deleteAccount({required String token, String? callbackURL}) Future<BaseResponseWithoutMessage>
Delete user
deleteUser({String? password, String? token, String? callbackURL}) Future<BaseResponseWithoutMessage>
Delete user
forgetPassword(String email, {String? callbackURL}) Future<void>
Send a forgot password email to the user.
getCustomPlugin<P extends BasePlugin<T>>() → P
Retrieve a custom plugin instance
getSession() Future<SessionResponse<T>>
Get the session of the user.
linkSocialAccount({required String provider, String? callbackURL, List<String>? scopes}) Future<SocialSignInResponse>
Link a social account to the user
listAccounts() Future<List<Account>>
List all accounts of the user
listSessions() Future<List<Session>>
List all sessions of the user.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parseCookiesFromRedirectURL(Uri url) Future<void>
Parse cookies from a redirect URL and update the token store
refreshToken({required String providerId, String? accountId, String? userId}) Future<TokenRefresh>
Refresh the access token using a refresh token
registerCustomPlugin<P extends BasePlugin<T>>(P plugin) → void
Register a custom plugin
resetPassword(String token, String newPassword) Future<void>
Reset the password of the user.
revokeOtherSessions() Future<BaseResponseWithoutMessage>
Revoke all sessions of the user except the current one
revokeSession({required String token}) Future<BaseResponseWithoutMessage>
Revoke a session
revokeSessions() Future<BaseResponseWithoutMessage>
Revoke all sessions of the user
sendVerificationEmail(String email, {String? callbackURL}) Future<void>
Send a verification email to the user.
signOut() Future<void>
Sign out the user. This calls TokenStore.saveToken with null.
toString() String
A string representation of this object.
inherited
unlinkAccount({required String providerId, String? accountId}) Future<BaseResponseWithoutMessage>
Unlink an account
updateUser({String? name, String? image, String? username}) Future<BaseResponseWithoutMessage>
Update the user's name and image.
verifyEmail({required String token, String? callbackURL}) Future<VerifyEmailResponse>
Verify the email of the user.

Operators

operator ==(Object other) bool
The equality operator.
inherited