Trigger a Password Reset Email with the Laravel-Auth0 SDK

Overview

When trying to trigger a password reset email, it appears that the /dbconnections/change_password endpoint is not exposed through the laravel-auth0 SDK.

Applies To

  • laravel-auth0 SDK
  • Password Reset Emails

Solution

This is possible by interacting with the underlying Auth0 PHP SDK, which is the foundation of the Auth0 Laravel SDK.

  1. Retrieve an instance of the Auth0 PHP SDK from the Auth0 Laravel SDK like this:
    use Auth0\Laravel\Facade\Auth0;
    
    $sdk = Auth0::getSdk();
    
  2. Then, it is possible to access the Authentication API class and use the dbConnectionsChangePassword() method:
    $sdk->authentication()->dbConnectionsChangePassword(
        email: [string],
        connection: [string],
        body: [array],
        headers: [array],
    );