public function BynderApi::hasAccessToken in Bynder 8.2
Same name and namespace in other branches
- 8.3 src/BynderApi.php \Drupal\bynder\BynderApi::hasAccessToken()
- 8 src/BynderApi.php \Drupal\bynder\BynderApi::hasAccessToken()
- 4.0.x src/BynderApi.php \Drupal\bynder\BynderApi::hasAccessToken()
Gets if the current user has a valid oAuth access token.
Return value
bool TRUE if the current user has a valid oAuth access token. FALSE otherwise.
Overrides BynderApiInterface::hasAccessToken
1 method overrides BynderApi::hasAccessToken()
- BynderApiTest::hasAccessToken in tests/
modules/ bynder_test_module/ src/ BynderApiTest.php - Returns value set in state.
File
- src/
BynderApi.php, line 202
Class
- BynderApi
- Bynder API service.
Namespace
Drupal\bynderCode
public function hasAccessToken() {
$session_data = $this->session
->get('bynder', []);
// Required tokens need to be stored in the session.
if (empty($session_data['access_token']['oauth_token']) || empty($session_data['access_token']['oauth_token_secret'])) {
return FALSE;
}
// In case of the global config change all user sessions need to expire.
if (empty($session_data['config_hash']) || $session_data['config_hash'] != $this->state
->get('bynder_config_hash')) {
return FALSE;
}
return TRUE;
}