Authentication
in package
implements
AuthenticationInterface
Class Authentication.
Interfaces, Classes, Traits and Enums
- AuthenticationInterface
- Interface AuthenticationInterface.
Table of Contents
- $configuration : SdkConfiguration|array<string|int, mixed>
- $httpClient : HttpClient|null
- Instance of Auth0\SDK\API\Utility\HttpClient.
- $validatedConfiguration : SdkConfiguration|null
- Instance of SdkConfiguration, for shared configuration across classes.
- __construct() : mixed
- Authentication constructor.
- clientCredentials() : ResponseInterface
- Makes a call to the `oauth/token` endpoint with `client_credentials` grant type.
- codeExchange() : ResponseInterface
- Makes a call to the `oauth/token` endpoint with `authorization_code` grant type.
- dbConnectionsChangePassword() : ResponseInterface
- Send a change password email.
- dbConnectionsSignup() : ResponseInterface
- Create a new user using active authentication.
- emailPasswordlessStart() : ResponseInterface
- Start passwordless login process for email.
- getConfiguration() : SdkConfiguration
- getHttpClient() : HttpClient
- Return the HttpClient instance being used for authentication API requests.
- getLoginLink() : string
- Build the login URL.
- getLogoutLink() : string
- Builds and returns a logout URL to terminate an SSO session.
- getSamlpLink() : string
- Build and return a SAMLP link.
- getSamlpMetadataLink() : string
- Build and return a SAMLP metadata link.
- getWsfedLink() : string
- Build and return a WS-Federation link.
- getWsfedMetadataLink() : string
- Build and return a WS-Federation metadata link.
- login() : ResponseInterface
- Makes a call to the `oauth/token` endpoint with `password-realm` grant type.
- loginWithDefaultDirectory() : ResponseInterface
- Makes a call to the `oauth/token` endpoint with `password` grant type.
- oauthToken() : ResponseInterface
- Makes a call to the `oauth/token` endpoint.
- passwordlessStart() : ResponseInterface
- Start passwordless login process.
- refreshToken() : ResponseInterface
- Use a refresh token grant to get new tokens.
- smsPasswordlessStart() : ResponseInterface
- Start passwordless login process for SMS.
- userInfo() : ResponseInterface
- Make an authenticated request to the /userinfo endpoint.
Properties
$configuration
private
SdkConfiguration|array<string|int, mixed>
$configuration
$httpClient
Instance of Auth0\SDK\API\Utility\HttpClient.
private
HttpClient|null
$httpClient
= null
$validatedConfiguration
Instance of SdkConfiguration, for shared configuration across classes.
private
SdkConfiguration|null
$validatedConfiguration
= null
Methods
__construct()
Authentication constructor.
public
__construct(array<string|int, mixed>|SdkConfiguration $configuration) : mixed
Parameters
- $configuration : array<string|int, mixed>|SdkConfiguration
-
Required. Base configuration options for the SDK. See the SdkConfiguration class constructor for options.
Tags
Return values
mixed —clientCredentials()
Makes a call to the `oauth/token` endpoint with `client_credentials` grant type.
public
clientCredentials([array<string|int, mixed>|null $params = null ][, array<string|int, mixed>|null $headers = null ]) : ResponseInterface
Parameters
- $params : array<string|int, mixed>|null = null
-
Optional. Additional content to include in the body of the API request. See @see for details.
- $headers : array<string|int, mixed>|null = null
-
Optional. Additional headers to send with the API request.
Return values
ResponseInterface —codeExchange()
Makes a call to the `oauth/token` endpoint with `authorization_code` grant type.
public
codeExchange(string $code[, string|null $redirectUri = null ][, string|null $codeVerifier = null ]) : ResponseInterface
Parameters
- $code : string
-
authorization code received during login
- $redirectUri : string|null = null
-
Optional. Redirect URI sent with authorize request. Defaults to the SDK's configured redirectUri.
- $codeVerifier : string|null = null
-
Optional. The clear-text version of the code_challenge from the /authorize call
Return values
ResponseInterface —dbConnectionsChangePassword()
Send a change password email.
public
dbConnectionsChangePassword(string $email, string $connection[, array<string|int, mixed>|null $body = null ][, array<string|int, mixed>|null $headers = null ]) : ResponseInterface
This endpoint only works for database connections.
Parameters
- $email : string
-
email for the user changing their password
- $connection : string
-
the name of the database connection this user is in
- $body : array<string|int, mixed>|null = null
-
Optional. Additional content to include in the body of the API request. See @see for details.
- $headers : array<string|int, mixed>|null = null
-
Optional. Additional headers to send with the API request.
Return values
ResponseInterface —dbConnectionsSignup()
Create a new user using active authentication.
public
dbConnectionsSignup(string $email, string $password, string $connection[, array<string|int, mixed>|null $body = null ][, array<string|int, mixed>|null $headers = null ]) : ResponseInterface
This endpoint only works for database connections.
Parameters
- $email : string
-
email for the user signing up
- $password : string
-
new password for the user signing up
- $connection : string
-
database connection to create the user in
- $body : array<string|int, mixed>|null = null
-
Optional. Additional content to include in the body of the API request. See @see for details.
- $headers : array<string|int, mixed>|null = null
-
Optional. Additional headers to send with the API request.
Return values
ResponseInterface —emailPasswordlessStart()
Start passwordless login process for email.
public
emailPasswordlessStart(string $email, string $type[, array<string|int, mixed>|null $params = null ][, array<string|int, mixed>|null $headers = null ]) : ResponseInterface
Parameters
- $email : string
-
email address to use
- $type : string
-
use null or "link" to send a link, use "code" to send a verification code
- $params : array<string|int, mixed>|null = null
-
Optional. Append or override the link parameters (like scope, redirect_uri, protocol, response_type) when you send a link using email.
- $headers : array<string|int, mixed>|null = null
-
Optional. Additional headers to send with the API request.
Return values
ResponseInterface —getConfiguration()
public
getConfiguration() : SdkConfiguration
Return values
SdkConfiguration —getHttpClient()
Return the HttpClient instance being used for authentication API requests.
public
getHttpClient() : HttpClient
Return values
HttpClient —getLoginLink()
Build the login URL.
public
getLoginLink(string $state[, string|null $redirectUri = null ][, array<string|int, mixed>|null $params = null ]) : string
Parameters
- $state : string
-
A CSRF mitigating value, also useful for restoring the previous state of your app. See https://auth0.com/docs/protocols/state-parameters
- $redirectUri : string|null = null
-
Optional. URI to return to after logging out. Defaults to the SDK's configured redirectUri.
- $params : array<string|int, mixed>|null = null
-
Optional. Additional parameters to include with the request. See @see for details.
Return values
string —getLogoutLink()
Builds and returns a logout URL to terminate an SSO session.
public
getLogoutLink([string|null $returnTo = null ][, array<string|int, mixed>|null $params = null ]) : string
Parameters
- $returnTo : string|null = null
-
Optional. URI to return to after logging out. Defaults to the SDK's configured redirectUri.
- $params : array<string|int, mixed>|null = null
-
Optional. Additional parameters to include with the request.
Return values
string —getSamlpLink()
Build and return a SAMLP link.
public
getSamlpLink([string|null $clientId = null ][, string|null $connection = null ]) : string
Parameters
- $clientId : string|null = null
-
Optional. Client ID to use. Defaults to the SDK's configured Client ID.
- $connection : string|null = null
-
Optional. The connection to use. If no connection is specified, the Auth0 Login Page will be shown.
Return values
string —getSamlpMetadataLink()
Build and return a SAMLP metadata link.
public
getSamlpMetadataLink([string|null $clientId = null ]) : string
Parameters
- $clientId : string|null = null
-
Optional. Client ID to use. Defaults to the SDK's configured Client ID.
Return values
string —getWsfedLink()
Build and return a WS-Federation link.
public
getWsfedLink([string|null $clientId = null ][, array<string|int, mixed>|null $params = null ]) : string
Parameters
- $clientId : string|null = null
-
Optional. Client ID to use. Defaults to the SDK's configured Client ID.
- $params : array<string|int, mixed>|null = null
-
Optional. Additional parameters to include with the request. See @see for details.
Return values
string —getWsfedMetadataLink()
Build and return a WS-Federation metadata link.
public
getWsfedMetadataLink() : string
Return values
string —login()
Makes a call to the `oauth/token` endpoint with `password-realm` grant type.
public
login(string $username, string $password, string $realm[, array<string|int, mixed>|null $params = null ][, array<string|int, mixed>|null $headers = null ]) : ResponseInterface
Parameters
- $username : string
-
username of the resource owner
- $password : string
-
password of the resource owner
- $realm : string
-
database realm the user belongs to
- $params : array<string|int, mixed>|null = null
-
Optional. Additional content to include in the body of the API request. See @see for details.
- $headers : array<string|int, mixed>|null = null
-
Optional. Additional headers to send with the API request.
Return values
ResponseInterface —loginWithDefaultDirectory()
Makes a call to the `oauth/token` endpoint with `password` grant type.
public
loginWithDefaultDirectory(string $username, string $password[, array<string|int, mixed>|null $params = null ][, array<string|int, mixed>|null $headers = null ]) : ResponseInterface
Parameters
- $username : string
-
username of the resource owner
- $password : string
-
password of the resource owner
- $params : array<string|int, mixed>|null = null
-
Optional. Additional content to include in the body of the API request. See @see for details.
- $headers : array<string|int, mixed>|null = null
-
Optional. Additional headers to send with the API request.
Return values
ResponseInterface —oauthToken()
Makes a call to the `oauth/token` endpoint.
public
oauthToken(string $grantType[, array<string|int, mixed>|null $params = null ][, array<string|int, mixed>|null $headers = null ]) : ResponseInterface
Parameters
- $grantType : string
-
Denotes the type of flow being used. See @see for details.
- $params : array<string|int, mixed>|null = null
-
Optional. Additional content to include in the body of the API request. See @see for details.
- $headers : array<string|int, mixed>|null = null
-
Optional. Additional headers to send with the API request.
Return values
ResponseInterface —passwordlessStart()
Start passwordless login process.
public
passwordlessStart([array<string|int, mixed>|null $body = null ][, array<string|int, mixed>|null $headers = null ]) : ResponseInterface
Parameters
- $body : array<string|int, mixed>|null = null
-
Optional. Additional content to include in the body of the API request. See @see for details.
- $headers : array<string|int, mixed>|null = null
-
Optional. Additional headers to send with the API request.
Return values
ResponseInterface —refreshToken()
Use a refresh token grant to get new tokens.
public
refreshToken(string $refreshToken[, array<string|int, mixed>|null $params = null ][, array<string|int, mixed>|null $headers = null ]) : ResponseInterface
Parameters
- $refreshToken : string
-
refresh token to use
- $params : array<string|int, mixed>|null = null
-
Optional. Additional parameters to include with the request.
- $headers : array<string|int, mixed>|null = null
-
Optional. Additional headers to send with the request.
Return values
ResponseInterface —smsPasswordlessStart()
Start passwordless login process for SMS.
public
smsPasswordlessStart(string $phoneNumber[, array<string|int, mixed>|null $headers = null ]) : ResponseInterface
Parameters
- $phoneNumber : string
-
phone number to use
- $headers : array<string|int, mixed>|null = null
-
Optional. Additional headers to send with the API request.
Return values
ResponseInterface —userInfo()
Make an authenticated request to the /userinfo endpoint.
public
userInfo(string $accessToken) : ResponseInterface
Parameters
- $accessToken : string
-
bearer token to use for the request