You are here

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

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

Parameters

string $code Authorization code received during login.:

string $redirect_uri Redirect URI sent with authorize request.:

Return value

mixed

Throws

ApiException If grant_type is missing.

File

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

Class

Authentication
Class Authentication

Namespace

Auth0\SDK\API

Code

public function code_exchange($code, $redirect_uri) {
  $options = [];
  $options['client_secret'] = $this->client_secret;
  $options['redirect_uri'] = $redirect_uri;
  $options['code'] = $code;
  $options['grant_type'] = 'authorization_code';
  return $this
    ->oauth_token($options);
}