AuthenticationApi class
An interface for calling some of the endpoints in Auth0's Authentication API.
This class presents building blocks for doing more fine-grained
authentication with Auth0 using Username and Password login. Unlike
WebAuthentication
, these do not use Auth0 Universal Login (the recommended way of doing authentication),
and thus users are not redirected to Auth0 for authentication.
It is not intended for you to instantiate this class yourself, as an
instance of it is already exposed as Auth0.api
.
Usage example:
final auth0 = Auth0('DOMAIN', 'CLIENT_ID');
final result = await auth0.api.login({
usernameOrEmail: 'my@email.com',
password: 'my_password'
connectionOrRealm: 'Username-Password-Authentication'
})
final accessToken = result.accessToken;
Constructors
- AuthenticationApi.new(Account _account, UserAgent _userAgent)
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
login(
{required String usernameOrEmail, required String password, required String connectionOrRealm, String? audience, Set< String> scopes = const {'openid', 'profile', 'email', 'offline_access'}, Map<String, String> parameters = const {}}) → Future<Credentials> -
Authenticates the user using a
usernameOrEmail
and apassword
, with the specifiedconnectionOrRealm
. If successful, it returns a set of tokens, as well as the user's profile (constructed from ID token claims). -
loginWithEmailCode(
{required String email, required String verificationCode, String? connection, Set< String> scopes = const {'openid', 'profile', 'email', 'offline_access'}, String? audience, Map<String, String> parameters = const {}}) → Future<Credentials> - Log in a user using an email and a verification code received via Email (Part of passwordless login flow). The default scope used is 'openid profile email offline_access'.
-
loginWithOtp(
{required String otp, required String mfaToken}) → Future< Credentials> -
Authenticates the user using a
mfaToken
and anotp
, after login returned with an ApiException with ApiException.isMultifactorRequired set totrue
. If successful, it returns a set of tokens, as well as the user's profile (constructed from ID token claims). -
loginWithSmsCode(
{required String phoneNumber, required String verificationCode, Set< String> scopes = const {'openid', 'profile', 'email', 'offline_access'}, String? audience, Map<String, String> parameters = const {}}) → Future<Credentials> - Log in a user using a phone number and a verification code received via SMS (Part of passwordless login flow). The default scope used is 'openid profile email offline_access'.
-
multifactorChallenge(
{required String mfaToken, List< ChallengeType> ? types, String? authenticatorId}) → Future<Challenge> - Requests a challenge for multi-factor authentication (MFA) based on the challenge types supported by the app and user.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
renewCredentials(
{required String refreshToken, Set< String> scopes = const {}, Map<String, String> parameters = const {}}) → Future<Credentials> -
Uses a
refreshToken
to get a new access token. -
resetPassword(
{required String email, required String connection, Map< String, String> parameters = const {}}) → Future<void> -
Initiates a reset of password of the user with the specific
email
address in the specificconnection
. -
signup(
{required String email, required String password, String? username, required String connection, Map< String, String> userMetadata = const {}, Map<String, String> parameters = const {}}) → Future<DatabaseUser> -
Registers a new user with the specified
email
address andpassword
in the specifiedconnection
. -
startPasswordlessWithEmail(
{required String email, required PasswordlessType passwordlessType, Map< String, String> parameters = const {}}) → Future<void> - Start a passwordless flow with an Email.
-
startPasswordlessWithPhoneNumber(
{required String phoneNumber, required PasswordlessType passwordlessType, Map< String, String> parameters = const {}}) → Future<void> - Start a passwordless flow with a SMS
-
toString(
) → String -
A string representation of this object.
inherited
-
userProfile(
{required String accessToken, Map< String, String> parameters = const {}}) → Future<UserProfile> -
Fetches the user's profile from the /userinfo endpoint. An
accessToken
from a successful authentication call must be supplied.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited