You are here

public function Users::generateRecoveryCode in Auth0 Single Sign On 8.2

Removes the current Guardian recovery code and generates and returns a new one. Required scope: "update:users"

@link https://auth0.com/docs/api/management/v2#!/Users/post_recovery_code_rege...

Parameters

string $user_id User ID to remove and generate recovery codes for.:

Return value

mixed

Throws

EmptyOrInvalidParameterException Thrown if the user_id parameter is empty or is not a string.

\Exception Thrown by the HTTP client when there is a problem with the API call.

File

vendor/auth0/auth0-php/src/API/Management/Users.php, line 487

Class

Users
Class Users. Handles requests to the Users endpoint of the v2 Management API.

Namespace

Auth0\SDK\API\Management

Code

public function generateRecoveryCode($user_id) {
  $this
    ->checkEmptyOrInvalidString($user_id, 'user_id');
  return $this->apiClient
    ->method('post')
    ->addPath('users', $user_id)
    ->addPath('recovery-code-regeneration')
    ->call();
}