protected function SocialApi::decryptToken in Social API 8.2
Same name and namespace in other branches
- 3.x src/Entity/SocialApi.php \Drupal\social_api\Entity\SocialApi::decryptToken()
Decrypts the stored token.
Parameters
string $token: Encrypted token stored in database.
Return value
string The plain-text token provided by the provider.
1 call to SocialApi::decryptToken()
- SocialApi::getToken in src/
Entity/ SocialApi.php - Returns the unencrypted, serialized access token.
File
- src/
Entity/ SocialApi.php, line 112
Class
- SocialApi
- Defines a base class for Social API content entities.
Namespace
Drupal\social_api\EntityCode
protected function decryptToken($token) {
$key = $this
->getEncryptionKey();
// Removes the base64 encoding from our key.
$encryption_key = base64_decode($key);
// Split the encrypted data from our IV - our unique separator used was
// "::".
list($encrypted_data, $iv) = explode('::', base64_decode($token), 2);
return openssl_decrypt($encrypted_data, 'aes-256-cbc', $encryption_key, 0, $iv);
}