You are here

public function Authentication::impersonate in Auth0 Single Sign On 8.2

Obtain an impersonation URL to login as another user. Impersonation functionality may be disabled by default for your tenant.

@codeCoverageIgnore - Deprecated

Parameters

string $access_token:

string $user_id:

string $protocol:

string $impersonator_id:

string $client_id:

array $additionalParameters:

Return value

mixed

Deprecated

5.4.0, legacy authentication pipeline, no alternative provided.

See also

https://auth0.com/docs/api/authentication#impersonation

File

vendor/auth0/auth0-php/src/API/Authentication.php, line 706

Class

Authentication
Class Authentication

Namespace

Auth0\SDK\API

Code

public function impersonate($access_token, $user_id, $protocol, $impersonator_id, $client_id, array $additionalParameters = []) {
  $data = [
    'protocol' => $protocol,
    'impersonator_id' => $impersonator_id,
    'client_id' => $client_id,
    'additionalParameters' => $additionalParameters,
  ];
  return $this->apiClient
    ->method('post')
    ->addPath('users', $user_id)
    ->addPath('impersonate')
    ->withHeader(new AuthorizationBearer($access_token))
    ->withBody(json_encode($data))
    ->call();
}