Authentication
extends ClientAbstract
in package
implements
AuthenticationInterface
Table of Contents
Interfaces
Constants
- CONST_CLIENT_ASSERTION_TYPE : string = 'urn:ietf:params:oauth:client-assertion-type:jw...
Properties
- $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.
Methods
- __construct() : mixed
- Authentication constructor.
- addClientAuthentication() : array<string|int, mixed>
- Add client authentication to a request.
- 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.
- customTokenExchange() : ResponseInterface
- Exchange an external or custom token for Auth0 tokens using the token exchange grant (RFC 8693).
- 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
- Return an instance of SdkConfiguration.
- getHttpClient() : HttpClient
- Return an instance of HttpClient.
- 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.
- pushedAuthorizationRequest() : PushedAuthorizationRequest
- Returns an instance of the Pushed Authorization Request endpoint class.
- 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.
Constants
CONST_CLIENT_ASSERTION_TYPE
public
string
CONST_CLIENT_ASSERTION_TYPE
= 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer'
Properties
$configuration read-only
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
addClientAuthentication()
Add client authentication to a request.
public
addClientAuthentication(array<string|int, mixed> $content) : array<string|int, mixed>
Parameters
- $content : array<string|int, mixed>
-
Request being sent to the endpoint.
Return values
array<string|int, mixed> —Request, with client authentication added.
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
ResponseInterfacecodeExchange()
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
ResponseInterfacecustomTokenExchange()
Exchange an external or custom token for Auth0 tokens using the token exchange grant (RFC 8693).
public
customTokenExchange(string $subjectToken, string $subjectTokenType[, string|null $actorToken = null ][, string|null $actorTokenType = null ][, array<string|int, mixed>|null $params = null ][, array<string|int, mixed>|null $headers = null ]) : ResponseInterface
Returns the raw token response and has no session side effects. Use this for delegation and machine-to-machine scenarios.
Parameters
- $subjectToken : string
-
the token being exchanged
- $subjectTokenType : string
-
a URI identifying the type of
subjectToken. Any custom URI scheme is accepted (e.g.urn:acme:token). - $actorToken : string|null = null
-
Optional. A token representing the acting party for delegation. Requires
actorTokenType. - $actorTokenType : string|null = null
-
Optional. A URI identifying the type of
actorToken. RequiresactorToken. - $params : array<string|int, mixed>|null = null
-
Optional. Additional content to include in the body of the API request, such as
audience,scope, andorganization. Thegrant_type,client_id,subject_token,subject_token_type,actor_token, andactor_token_typekeys are controlled by the SDK and cannot be overridden here. - $headers : array<string|int, mixed>|null = null
-
Optional. Additional headers to send with the API request.
Return values
ResponseInterfacedbConnectionsChangePassword()
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
ResponseInterfacedbConnectionsSignup()
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
ResponseInterfaceemailPasswordlessStart()
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
ResponseInterfacegetConfiguration()
Return an instance of SdkConfiguration.
public
getConfiguration() : SdkConfiguration
Return values
SdkConfigurationgetHttpClient()
Return an instance of HttpClient.
public
getHttpClient() : HttpClient
Return values
HttpClientgetLoginLink()
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. The
client_id,response_type, andresponse_modekeys are controlled by the SDK and cannot be overridden here. See @see for details.
Return values
stringgetLogoutLink()
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. The
client_id,response_type, andresponse_modekeys are controlled by the SDK and cannot be overridden here.
Return values
stringgetSamlpLink()
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
stringgetSamlpMetadataLink()
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
stringgetWsfedLink()
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
stringgetWsfedMetadataLink()
Build and return a WS-Federation metadata link.
public
getWsfedMetadataLink() : string
Return values
stringlogin()
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
ResponseInterfaceloginWithDefaultDirectory()
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
ResponseInterfaceoauthToken()
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
ResponseInterfacepasswordlessStart()
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
ResponseInterfacepushedAuthorizationRequest()
Returns an instance of the Pushed Authorization Request endpoint class.
public
pushedAuthorizationRequest() : PushedAuthorizationRequest
Return values
PushedAuthorizationRequestrefreshToken()
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
ResponseInterfacesmsPasswordlessStart()
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
ResponseInterfaceuserInfo()
Make an authenticated request to the /userinfo endpoint.
public
userInfo(string $accessToken) : ResponseInterface
Parameters
- $accessToken : string
-
bearer token to use for the request