public function OAuth2Client::init in OAuth2 Client 8
Initialize an OAuth2Client object.
Parameters
array $params: Associative array of the parameters that are needed by the different types of authorization flows.
string $id: ID of the client. If not given, it will be generated from token_endpoint, client_id and auth_flow.
Overrides OAuth2ClientInterface::init
File
- src/
Service/ OAuth2Client.php, line 128
Class
- OAuth2Client
- OAuth2Client service.
Namespace
Drupal\oauth2_client\ServiceCode
public function init($params = NULL, $id = NULL) {
if ($params) {
$this->params = $params + $this->params;
}
if (!$id) {
$id = md5($this->params['token_endpoint'] . $this->params['client_id'] . $this->params['auth_flow']);
}
$this->id = $id;
// Get the token data from the tempstore, if it is stored there.
$tokens = $this->tempstore
->get('token');
if (isset($tokens[$this->id])) {
$this->token = $tokens[$this->id] + $this->token;
}
}