mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-28 07:50:23 +05:30
Merge pull request #536 from Bobselp/V5-WIP
less verbose exceptions for RefreshTokenGrant
This commit is contained in:
commit
3e8577f889
@ -101,17 +101,13 @@ class RefreshTokenGrant extends AbstractGrant
|
|||||||
try {
|
try {
|
||||||
$refreshToken = $this->decrypt($encryptedRefreshToken);
|
$refreshToken = $this->decrypt($encryptedRefreshToken);
|
||||||
} catch (\LogicException $e) {
|
} catch (\LogicException $e) {
|
||||||
throw OAuthServerException::invalidRefreshToken('Cannot parse refresh token: ' . $e->getMessage());
|
throw OAuthServerException::invalidRefreshToken('Cannot decrypt the refresh token');
|
||||||
}
|
}
|
||||||
|
|
||||||
$refreshTokenData = json_decode($refreshToken, true);
|
$refreshTokenData = json_decode($refreshToken, true);
|
||||||
if ($refreshTokenData['client_id'] !== $clientId) {
|
if ($refreshTokenData['client_id'] !== $clientId) {
|
||||||
$this->getEmitter()->emit(new RequestEvent('refresh_token.client.failed', $request));
|
$this->getEmitter()->emit(new RequestEvent('refresh_token.client.failed', $request));
|
||||||
throw OAuthServerException::invalidRefreshToken(
|
throw OAuthServerException::invalidRefreshToken('Token is not linked to client');
|
||||||
'Token is not linked to client,' .
|
|
||||||
' got: ' . $clientId .
|
|
||||||
' expected: ' . $refreshTokenData['client_id']
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($refreshTokenData['expire_time'] < time()) {
|
if ($refreshTokenData['expire_time'] < time()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user