Auth0-PHP

AuthenticationInterface extends ClientInterface
in

Table of Contents

Methods

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.
getLastRequest()  : HttpRequest|null
Return an instance of HttpRequest representing the last issued request.
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.

Methods

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.

Tags
throws
TokenException

If client assertion signing key or algorithm is invalid.

ConfigurationException

If client ID or secret are invalid.

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([null|array<string|int, null|int|string> $params = null ][, null|array<string|int, int|string> $headers = null ]) : ResponseInterface
Parameters
$params : null|array<string|int, null|int|string> = null

Optional. Additional content to include in the body of the API request. See @see for details.

$headers : null|array<string|int, int|string> = null

Optional. Additional headers to send with the API request.

Tags
throws
ConfigurationException

when a Client ID is not configured

ConfigurationException

when a Client Secret is not configured

NetworkException

when the API request fails due to a network error

see
https://auth0.com/docs/api/authentication#client-credentials-flow
https://auth0.com/docs/authorization/flows/client-credentials-flow
Return values
ResponseInterface

codeExchange()

Makes a call to the `oauth/token` endpoint with `authorization_code` grant type.

public codeExchange(string $code[, null|string $redirectUri = null ][, null|string $codeVerifier = null ]) : ResponseInterface
Parameters
$code : string

authorization code received during login

$redirectUri : null|string = null

Optional. Redirect URI sent with authorize request. Defaults to the SDK's configured redirectUri.

$codeVerifier : null|string = null

Optional. The clear-text version of the code_challenge from the /authorize call

Tags
throws
ArgumentException

when an invalid code is passed

ConfigurationException

when a Client ID is not configured

ConfigurationException

when a Client Secret is not configured

ConfigurationException

when a redirect uri is not configured

NetworkException

when the API request fails due to a network error

see
https://auth0.com/docs/api/authentication#authorization-code-flow
https://auth0.com/docs/api/authentication#authorization-code-flow-with-pkce
Return values
ResponseInterface

customTokenExchange()

Exchange an external or custom token for Auth0 tokens using the token exchange grant (RFC 8693).

public customTokenExchange(string $subjectToken, string $subjectTokenType[, null|string $actorToken = null ][, null|string $actorTokenType = null ][, null|array<string|int, null|int|string> $params = null ][, null|array<string|int, int|string> $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 : null|string = null

Optional. A token representing the acting party for delegation. Requires actorTokenType.

$actorTokenType : null|string = null

Optional. A URI identifying the type of actorToken. Requires actorToken.

$params : null|array<string|int, null|int|string> = null

Optional. Additional content to include in the body of the API request, such as audience, scope, and organization. The grant_type, client_id, subject_token, subject_token_type, actor_token, and actor_token_type keys are controlled by the SDK and cannot be overridden here.

$headers : null|array<string|int, int|string> = null

Optional. Additional headers to send with the API request.

Tags
throws
ArgumentException

when subjectToken is blank, subjectTokenType is blank or not a valid URI, or the actor token and its type are not supplied together

ConfigurationException

when a Client ID is not configured

ConfigurationException

when a Client Secret is not configured

NetworkException

when the API request fails due to a network error

see
https://auth0.com/docs/authenticate/custom-token-exchange
https://datatracker.ietf.org/doc/html/rfc8693
Return values
ResponseInterface

dbConnectionsChangePassword()

Send a change password email.

public dbConnectionsChangePassword(string $email, string $connection[, null|array<string|int, mixed> $body = null ][, null|array<string|int, int|string> $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 : null|array<string|int, mixed> = null

Optional. Additional content to include in the body of the API request. See @see for details.

$headers : null|array<string|int, int|string> = null

Optional. Additional headers to send with the API request.

Tags
throws
ArgumentException

when an invalid email or connection are passed

ConfigurationException

when a Client ID is not configured

NetworkException

when the API request fails due to a network error

see
https://auth0.com/docs/api/authentication#change-password
Return values
ResponseInterface

dbConnectionsSignup()

Create a new user using active authentication.

public dbConnectionsSignup(string $email, string $password, string $connection[, null|array<string|int, mixed> $body = null ][, null|array<string|int, int|string> $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 : null|array<string|int, mixed> = null

Optional. Additional content to include in the body of the API request. See @see for details.

$headers : null|array<string|int, int|string> = null

Optional. Additional headers to send with the API request.

Tags
throws
ArgumentException

when an invalid email, password, or connection are passed

ConfigurationException

when a Client ID is not configured

NetworkException

when the API request fails due to a network error

see
https://auth0.com/docs/api/authentication#signup
Return values
ResponseInterface

emailPasswordlessStart()

Start passwordless login process for email.

public emailPasswordlessStart(string $email, string $type[, null|array<string, null|string> $params = null ][, null|array<string|int, int|string> $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 : null|array<string, null|string> = null

Optional. Append or override the link parameters (like scope, redirect_uri, protocol, response_type) when you send a link using email.

$headers : null|array<string|int, int|string> = null

Optional. Additional headers to send with the API request.

Tags
throws
ArgumentException

when an invalid email or type are passed

ConfigurationException

when a Client ID is not configured

ConfigurationException

when a Client Secret is not configured

NetworkException

when the API request fails due to a network error

see
https://auth0.com/docs/api/authentication#get-code-or-link
Return values
ResponseInterface

Build the login URL.

public getLoginLink(string $state[, null|string $redirectUri = null ][, null|array<string|int, null|int|string> $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 : null|string = null

Optional. URI to return to after logging out. Defaults to the SDK's configured redirectUri.

$params : null|array<string|int, null|int|string> = null

Optional. Additional parameters to include with the request. The client_id, response_type, and response_mode keys are controlled by the SDK and cannot be overridden here. See @see for details.

throws
ArgumentException

when an invalid state is passed

ConfigurationException

when a Client ID is not configured

ConfigurationException

when a $redirectUri is not configured

see
https://auth0.com/docs/api/authentication#authorize-application
Return values
string

Builds and returns a logout URL to terminate an SSO session.

public getLogoutLink([null|string $returnTo = null ][, null|array<string|int, null|int|string> $params = null ]) : string
Parameters
$returnTo : null|string = null

Optional. URI to return to after logging out. Defaults to the SDK's configured redirectUri.

$params : null|array<string|int, null|int|string> = null

Optional. Additional parameters to include with the request. The client_id, response_type, and response_mode keys are controlled by the SDK and cannot be overridden here.

throws
ConfigurationException

when a Client ID is not configured

ConfigurationException

when a $returnUri is not configured

see
https://auth0.com/docs/api/authentication#logout
Return values
string

Build and return a SAMLP link.

public getSamlpLink([null|string $clientId = null ][, null|string $connection = null ]) : string
Parameters
$clientId : null|string = null

Optional. Client ID to use. Defaults to the SDK's configured Client ID.

$connection : null|string = null

Optional. The connection to use. If no connection is specified, the Auth0 Login Page will be shown.

throws
ConfigurationException

when a $clientId is not configured

see
https://auth0.com/docs/connections/enterprise/samlp
Return values
string

Build and return a WS-Federation link.

public getWsfedLink([null|string $clientId = null ][, null|array<string|int, null|int|string> $params = null ]) : string
Parameters
$clientId : null|string = null

Optional. Client ID to use. Defaults to the SDK's configured Client ID.

$params : null|array<string|int, null|int|string> = null

Optional. Additional parameters to include with the request. See @see for details.

throws
ConfigurationException

when a $clientId is not configured

see
https://auth0.com/docs/protocols/ws-fed
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[, null|array<string|int, null|int|string> $params = null ][, null|array<string|int, int|string> $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 : null|array<string|int, null|int|string> = null

Optional. Additional content to include in the body of the API request. See @see for details.

$headers : null|array<string|int, int|string> = null

Optional. Additional headers to send with the API request.

Tags
throws
ArgumentException

when an invalid username, password, or realm are passed

ConfigurationException

when a Client ID is not configured

ConfigurationException

when a Client Secret is not configured

NetworkException

when the API request fails due to a network error

see
https://auth0.com/docs/api/authentication#resource-owner-password
https://auth0.com/docs/authorization/flows/resource-owner-password-flow
Return values
ResponseInterface

loginWithDefaultDirectory()

Makes a call to the `oauth/token` endpoint with `password` grant type.

public loginWithDefaultDirectory(string $username, string $password[, null|array<string|int, null|int|string> $params = null ][, null|array<string|int, int|string> $headers = null ]) : ResponseInterface
Parameters
$username : string

username of the resource owner

$password : string

password of the resource owner

$params : null|array<string|int, null|int|string> = null

Optional. Additional content to include in the body of the API request. See @see for details.

$headers : null|array<string|int, int|string> = null

Optional. Additional headers to send with the API request.

Tags
throws
ArgumentException

when an invalid username or password are passed

ConfigurationException

when a Client ID is not configured

ConfigurationException

when a Client Secret is not configured

NetworkException

when the API request fails due to a network error

see
https://auth0.com/docs/api/authentication#resource-owner-password
https://auth0.com/docs/authorization/flows/resource-owner-password-flow
Return values
ResponseInterface

oauthToken()

Makes a call to the `oauth/token` endpoint.

public oauthToken(string $grantType[, null|array<string|int, null|int|string> $params = null ][, null|array<string|int, int|string> $headers = null ]) : ResponseInterface
Parameters
$grantType : string

Denotes the type of flow being used. See @see for details.

$params : null|array<string|int, null|int|string> = null

Optional. Additional content to include in the body of the API request. See @see for details.

$headers : null|array<string|int, int|string> = null

Optional. Additional headers to send with the API request.

Tags
throws
ArgumentException

when an invalid grantType is passed

ConfigurationException

when a Client ID is not configured

ConfigurationException

when a Client Secret is not configured

NetworkException

when the API request fails due to a network error

see
https://auth0.com/docs/api/authentication#get-token
Return values
ResponseInterface

passwordlessStart()

Start passwordless login process.

public passwordlessStart([null|array<string|int, mixed> $body = null ][, null|array<string|int, int|string> $headers = null ]) : ResponseInterface
Parameters
$body : null|array<string|int, mixed> = null

Optional. Additional content to include in the body of the API request. See @see for details.

$headers : null|array<string|int, int|string> = null

Optional. Additional headers to send with the API request.

Tags
throws
ConfigurationException

when a Client ID is not configured

ConfigurationException

when a Client Secret is not configured

NetworkException

when the API request fails due to a network error

see
https://auth0.com/docs/api/authentication#get-code-or-link
Return values
ResponseInterface

refreshToken()

Use a refresh token grant to get new tokens.

public refreshToken(string $refreshToken[, null|array<string|int, null|int|string> $params = null ][, null|array<string|int, int>|array<string|int, string> $headers = null ]) : ResponseInterface
Parameters
$refreshToken : string

refresh token to use

$params : null|array<string|int, null|int|string> = null

Optional. Additional parameters to include with the request.

$headers : null|array<string|int, int>|array<string|int, string> = null

Optional. Additional headers to send with the request.

Tags
throws
ArgumentException

when an invalid refreshToken is passed

ConfigurationException

when a Client ID is not configured

ConfigurationException

when a Client Secret is not configured

NetworkException

when the API request fails due to a network error

see
https://auth0.com/docs/api/authentication#refresh-token
Return values
ResponseInterface

smsPasswordlessStart()

Start passwordless login process for SMS.

public smsPasswordlessStart(string $phoneNumber[, null|array<string|int, int|string> $headers = null ]) : ResponseInterface
Parameters
$phoneNumber : string

phone number to use

$headers : null|array<string|int, int|string> = null

Optional. Additional headers to send with the API request.

Tags
throws
ArgumentException

when an invalid phoneNumber is passed

ConfigurationException

when a Client ID is not configured

ConfigurationException

when a Client Secret is not configured

NetworkException

when the API request fails due to a network error

see
https://auth0.com/docs/api/authentication#get-code-or-link
Return values
ResponseInterface
On this page

Search results