public function BynderApi::finishOAuthTokenRetrieval in Bynder 4.0.x
Same name and namespace in other branches
- 8.3 src/BynderApi.php \Drupal\bynder\BynderApi::finishOAuthTokenRetrieval()
- 8 src/BynderApi.php \Drupal\bynder\BynderApi::finishOAuthTokenRetrieval()
- 8.2 src/BynderApi.php \Drupal\bynder\BynderApi::finishOAuthTokenRetrieval()
Finishes the access token retrieval after the user has been redirected.
When Bynder redirects the user back after the successful login this function takes over and gets the access token and stores it for the future use.
Parameters
string code: The Oauth authorization code.
Overrides BynderApiInterface::finishOAuthTokenRetrieval
File
- src/
BynderApi.php, line 250
Class
- BynderApi
- Bynder API service.
Namespace
Drupal\bynderCode
public function finishOAuthTokenRetrieval($code) {
$bynder_configuration = $this
->getOauthConfiguration();
$this->bynderApi = new BynderClient($bynder_configuration);
$session_data = $this->session
->get('bynder', []);
$session_data['access_token'] = $this->bynderApi
->getAccessToken($code);
$session_data['config_hash'] = $this->state
->get('bynder_config_hash');
$this->session
->set('bynder', $session_data);
}