The v7 major release adds some new features, removes a number of deprecated methods and classes, and changes how some applications need to be configured. Please read through this guide to make sure your application is up to date before upgrading to v7.
Only potentially breaking changes are covered in this guide. For a list of all changes for this major, see the 7.0.0 milestone on GitHub.
The v7 release requires PHP 7.1 or later to enable a number of helpful features like type hinting and null coalescing.
A number of breaking changes were made to the Auth0 class configuration passed in at initialization.
The main breaking change is only for applications that accept HS256 ID tokens. If your application is set to accept ID tokens signed using the HS256 algorithm, we recommend changing that to RS256 in the Auth0 Application > Settings tab > Advanced settings > OAuth tab > JsonWebToken Signature Algorithm field before upgrading and leaving the id_token_alg configuration key unset. If your application cannot be changed for some reason, set the id_token_alg configuration key to HS256, like so:
$auth0 = new Auth0([
'domain' => 'your-tenant.auth0.com',
'client_id' => 'application_client_id',
'client_secret' => 'application_client_secret',
'redirect_uri' => 'https://yourapplication.com/auth/callback',
'id_token_alg' => 'HS256'
]);The id_token_aud and id_token_iss configuration keys have been removed and their values will now be ignored.
The state_handler configuration key has been removed and the transient_store configuration key has been added. See the State and nonce handling section below for more information about the changes with state handling.
The ability to pass false in the store configuration key has been removed. Set store to an instance of EmptyStore or set all persist_* configuration keys to false to skip all persistence.
The cache_handler configuration key must now be an instance of Psr\SimpleCache\CacheInterface. See the Cache handling section below for more information.
The default secret_base64_encoded value is now false and is no longer stored in a property.
The client_secret configuration key is no longer required for class initialization (but will throw an exception in certain methods when required). If secret_base64_encoded is set to true then then the clientSecret property will now contain the decoded secret. If your Application is using an encoded secret, this encoding can be turned off tby rotating the client secret in the Auth0 Application settings.
The session_cookie_expires configuration key has been removed. The session cookie expiration should be managed in the application. If you were using this setting before, see the PHP core function session_set_cookie_params() to set this value after upgrading.
The session_base_name configuration key has been removed. Instead, pass an instance of StoreInterface in the store configuration key with the modified name.
The skip_userinfo configuration key now defaults to true. This means that the persisted user identity will now come from the ID token rather than a call to the userinfo endpoint. This can be set to false to return to the behavior in v5.
The ENV variables AUTH0_DOMAIN, AUTH0_CLIENT_ID, and AUTH0_REDIRECT_URI will now be used automatically for the domain, client_id, and redirect_uri configuration keys, respectively.
The debug configuration key was removed.
Cache handling has been changed in v7 to conform to the PSR-16 standard (see the discussion here). Objects passed to the cache_handler configuration key in Auth0 and the first parameter of the JWKFetcher class should be instances of Psr\SimpleCache\CacheInterface.
The handling for transient authentication data, such as state and nonce, has been changed.
In an effort to enforce security standards set forth in the OAuth and OpenID Connect specifications, state checking on the callback route and nonce checking for all received ID tokens is now mandatory. Applications that require IdP-initiated sign-on should add a login route that uses Auth0->getLoginUrl() to redirect through Auth0 with valid state and nonce values. The URL to this route should be saved to the Application Login URI field in your Auth0 Application to assist with this scenario.
The handling for these values was changed from PHP session-stored values to cookies using the new CookieStore class. This was done so PHP session usage was not required and to assist with applications using a form_post reponse mode. This change may require server-level whitelisting of cookie names (auth0__nonce and auth0__state by default) on some managed hosts. The transient_store configuration key in the Auth0 class can be used to switch back to PHP sessions or provide another method.
The default state key was changed from auth0__webauth_state to auth0__state.
The following classes were removed in v7:
- Class
Firebase\JWT\JWTprovided by thefirebase/php-jwtpackage was replaced with classes from thelcobucci/jwtpackage - Class
JWTVerifierwas removed, see theAuth0->decodeIdToken()method for how to use the replacement classes - Class
StateHandlerwas removed, see the State and nonce handling section above for more information - Class
SessionStateHandlerwas removed, see the State and nonce handling section above for more information - Class
DummyStateHandlerwas removed, see the State and nonce handling section above for more information - Interface
CacheHandlerwas removed, see the Cache handling section above for more information - Class
FileSystemCacheHandlerwas removed, see the Cache handling section above for more information - Class
TokenGeneratorwas removed, no replacement provided - Class
Oauth2Clientwas removed, no replacement provided - Class
Auth0Apiwas removed, no replacement provided - Class
Auth0AuthApiwas removed, no replacement provided - Class
Auth0JWTwas removed, no replacement provided
The following class constructors were changed in v7:
- Class
Authenticationnow requires aclient_idparameter - Class
NoCacheHandlernow implementsPsr\SimpleCache\CacheInterface - Class
JWKFetchernow requires an instance ofPsr\SimpleCache\CacheInterfaceas the first construct parameter - Class constant
SessionStore::COOKIE_EXPIRESwas removed - Class
SessionStoreno longer accepts a 2nd constructor argument to adjust the session cookie expiration; see the PHP core function session_set_cookie_params() to set this value in v7 - Class
Auth0\SDK\API\Header\Authorization\AuthorizationBearerwas changed toAuth0\SDK\API\Header\AuthorizationBearer
The following methods were changed in a breaking way in v7:
- Public method
RequestBuilder->withHeader()now only accepts aHeaderinstance as an argument. - Public method
Authentication->code_exchange()now throws anApiExceptionif class-levelclient_secretis empty - Public method
Authentication->client_credentials()now throws anApiExceptionifaudienceis empty - Public method
Authentication->get_authorize_link()now adds class-levelscopeandaudienceif none are passed in
The following methods were removed in v7:
- Public magic method
ApiClient->__call()was removed, useApiClient->method()to indicate an HTTP verb to use - Public magic method
RequestBuilder->__call()was removed, useRequestBuilder->addPath()to add paths - Public method
RequestBuilder->addPathVariable()was removed, useRequestBuilder->addPath()to add paths - Public method
RequestBuilder->dump()was removed, no replacement provided - Public method
RequestBuilder->withParams()was removed, useRequestBuilder->withDictParams()to add params - Public method
InformationHeaders->setEnvironment()was removed, no replacement provided - Public method
InformationHeaders->setDependency()was removed, no replacement provided - Public method
InformationHeaders->setDependencyData()was removed, no replacement provided - Public method
ClientGrants->get()was removed, no replacement provided - Public method
Users->search()was removed, useUsers->getAll()instead - Public method
Users->unlinkDevice()was removed, no replacement provided - Public method
JWKFetcher->requestJwkX5c()was removed, useJWKFetcher->getKeys()instead - Public method
JWKFetcher->findJwk()was removed, useJWKFetcher->getKeys()instead - Public method
JWKFetcher->subArrayHasEmptyFirstItem()was removed, no replacement provided - Public method
JWKFetcher->fetchKeys()was removed, useJWKFetcher->getKeys()instead - Public method
Authentication->authorize_with_ro()was removed, no replacement provided - Public method
Authentication->authorize_with_accesstoken()was removed, no replacement provided - Public method
Authentication->impersonate()was removed, no replacement provided - Public method
Authentication->email_code_passwordless_verify()was removed, no replacement provided - Public method
Authentication->sms_code_passwordless_verify()was removed, no replacement provided - Public method
Auth0->setDebugger()was removed, no replacement provided - Protected method
Authentication->setApiClient()was removed, no replacement provided - Protected method
Management->setApiClient()was removed, no replacement provided
The following properties were removed in v7:
- Public property
Management->blacklistswas made private, replaced byManagement->blacklists() - Public property
Management->clientswas made private, replaced byManagement->clients() - Public property
Management->client_grantswas made private, replaced byManagement->clientGrants() - Public property
Management->connectionswas made private, replaced byManagement-> connections() - Public property
Management->deviceCredentialswas made private, replaced byManagement->deviceCredentials() - Public property
Management->emailswas made private, replaced byManagement->emails() - Public property
Management->emailTemplateswas made private, replaced byManagement->emailTemplates() - Public property
Management->grantswas made private, replaced byManagement->grants() - Public property
Management->jobswas made private, replaced byManagement->jobs() - Public property
Management->logswas made private, replaced byManagement->logs() - Public property
Management->roleswas made private, replaced byManagement->roles() - Public property
Management->ruleswas made private, replaced byManagement->rules() - Public property
Management->resource_serverswas made private, replaced byManagement->resourceServers() - Public property
Management->statswas made private, replaced byManagement->stats() - Public property
Management->tenantswas made private, replaced byManagement->tenants() - Public property
Management->ticketswas made private, replaced byManagement->tickets() - Public property
Management->userBlockswas made private, replaced byManagement->userBlocks() - Public property
Management->userswas made private, replaced byManagement->users() - Public property
Management->usersByEmailwas made private, replaced byManagement->usersByEmail() - Public static property
Auth0::$URL_MAPwas removed - Protected property
Auth0->stateHandlerwas removed - Protected property
Auth0->clientSecretEncodedwas removed - Protected property
Auth0->debugModewas removed - Protected property
Auth0->debuggerwas removed - Protected property
SessionStore->session_cookie_expireswas removed