You are here

protected function OpenIDConnectClientBase::getRequestOptions in OpenID Connect / OAuth client 8

Same name and namespace in other branches
  1. 2.x src/Plugin/OpenIDConnectClientBase.php \Drupal\openid_connect\Plugin\OpenIDConnectClientBase::getRequestOptions()

Helper function for request options.

Parameters

string $authorization_code: Authorization code received as a result of the the authorization request.

string $redirect_uri: URI to redirect for authorization.

Return value

array Array with request options.

1 call to OpenIDConnectClientBase::getRequestOptions()
OpenIDConnectClientBase::retrieveTokens in src/Plugin/OpenIDConnectClientBase.php
Retrieve access token and ID token.

File

src/Plugin/OpenIDConnectClientBase.php, line 308

Class

OpenIDConnectClientBase
Base class for OpenID Connect client plugins.

Namespace

Drupal\openid_connect\Plugin

Code

protected function getRequestOptions($authorization_code, $redirect_uri) {
  return [
    'form_params' => [
      'code' => $authorization_code,
      'client_id' => $this->configuration['client_id'],
      'client_secret' => $this->configuration['client_secret'],
      'redirect_uri' => $redirect_uri,
      'grant_type' => 'authorization_code',
    ],
    'headers' => [
      'Accept' => 'application/json',
    ],
  ];
}