AuthenticationApi class Null safety
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(Account _account, UserAgent _userAgent)
Properties
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
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). -
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). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent 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
. -
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