Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/OAuth2/Encryption/FirebaseJwt.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ class FirebaseJwt implements EncryptionInterface
{
public function __construct()
{
if (!class_exists('\JWT')) {
if (!class_exists('\Firebase\JWT\JWT')) {
throw new \ErrorException('firebase/php-jwt must be installed to use this feature. You can do this by running "composer require firebase/php-jwt"');
}
}

public function encode($payload, $key, $alg = 'HS256', $keyId = null)
{
return \JWT::encode($payload, $key, $alg, $keyId);
return \Firebase\JWT\JWT::encode($payload, $key, $alg, $keyId);
}

public function decode($jwt, $key = null, $allowedAlgorithms = null)
Expand All @@ -29,19 +29,19 @@ public function decode($jwt, $key = null, $allowedAlgorithms = null)
$key = null;
}

return (array)\JWT::decode($jwt, $key, $allowedAlgorithms);
return (array)\Firebase\JWT\JWT::decode($jwt, $key, $allowedAlgorithms);
} catch (\Exception $e) {
return false;
}
}

public function urlSafeB64Encode($data)
{
return \JWT::urlsafeB64Encode($data);
return \Firebase\JWT\JWT::urlsafeB64Encode($data);
}

public function urlSafeB64Decode($b64)
{
return \JWT::urlsafeB64Decode($b64);
return \Firebase\JWT\JWT::urlsafeB64Decode($b64);
}
}
2 changes: 1 addition & 1 deletion src/OAuth2/Storage/JwtAccessToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function getAccessToken($oauth_token)
}

$client_id = isset($tokenData['aud']) ? $tokenData['aud'] : null;
$public_key = $this->publicKeyStorage->getPublicKey($client_id);
$public_key = $this->publicKeyStorage->getPrivateKey();
$algorithm = $this->publicKeyStorage->getEncryptionAlgorithm($client_id);

// now that we have the client_id, verify the token
Expand Down