Skip to content

Commit 6a61aa5

Browse files
committed
revoke-handler: throw InvalidClientError if client_id does not match with token.client.id
1 parent 2677693 commit 6a61aa5

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/handlers/revoke-handler.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ RevokeHandler.prototype.getRefreshToken = function(token, client) {
239239
}
240240

241241
if (token.client.id !== client.id) {
242-
throw new InvalidTokenError('Invalid token: refresh token client is invalid');
242+
throw new InvalidClientError('Invalid client: client is invalid');
243243
}
244244

245245
if (token.refreshTokenExpiresAt && !(token.refreshTokenExpiresAt instanceof Date)) {
@@ -274,7 +274,7 @@ RevokeHandler.prototype.getAccessToken = function(token, client) {
274274
}
275275

276276
if (accessToken.client.id !== client.id) {
277-
throw new InvalidTokenError('Invalid token: access token client is invalid');
277+
throw new InvalidClientError('Invalid client: client is invalid');
278278
}
279279

280280
if (accessToken.accessTokenExpiresAt && !(accessToken.accessTokenExpiresAt instanceof Date)) {

test/integration/handlers/revoke-handler_test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -635,8 +635,8 @@ describe('RevokeHandler integration', function() {
635635
return handler.getRefreshToken('hash', client)
636636
.then(should.fail)
637637
.catch(function(e) {
638-
e.should.be.an.instanceOf(InvalidTokenError);
639-
e.message.should.equal('Invalid token: refresh token client is invalid');
638+
e.should.be.an.instanceOf(InvalidClientError);
639+
e.message.should.equal('Invalid client: client is invalid');
640640
});
641641
});
642642

@@ -712,8 +712,8 @@ describe('RevokeHandler integration', function() {
712712
return handler.getAccessToken('hash', client)
713713
.then(should.fail)
714714
.catch(function(e) {
715-
e.should.be.an.instanceOf(InvalidTokenError);
716-
e.message.should.equal('Invalid token: access token client is invalid');
715+
e.should.be.an.instanceOf(InvalidClientError);
716+
e.message.should.equal('Invalid client: client is invalid');
717717
});
718718
});
719719

0 commit comments

Comments
 (0)