From 19c8ced6b20774b75811b1147ab88924280a7470 Mon Sep 17 00:00:00 2001 From: Christopher Franko Date: Sat, 16 Apr 2022 10:59:01 -0400 Subject: [PATCH] RefreshTokenGrant: update error messages --- lib/grant-types/refresh-token-grant-type.js | 4 ++-- test/integration/grant-types/refresh-token-grant-type_test.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/grant-types/refresh-token-grant-type.js b/lib/grant-types/refresh-token-grant-type.js index c9a25df..9787b08 100644 --- a/lib/grant-types/refresh-token-grant-type.js +++ b/lib/grant-types/refresh-token-grant-type.js @@ -101,7 +101,7 @@ RefreshTokenGrantType.prototype.getRefreshToken = function(request, client) { } if (token.client.id !== client.id) { - throw new InvalidGrantError('Invalid grant: refresh token is invalid'); + throw new InvalidGrantError('Invalid grant: refresh token was issued to another client'); } if (token.refreshTokenExpiresAt && !(token.refreshTokenExpiresAt instanceof Date)) { @@ -130,7 +130,7 @@ RefreshTokenGrantType.prototype.revokeToken = function(token) { return promisify(this.model.revokeToken, 1).call(this.model, token) .then(function(status) { if (!status) { - throw new InvalidGrantError('Invalid grant: refresh token is invalid'); + throw new InvalidGrantError('Invalid grant: refresh token is invalid or could not be revoked'); } return token; diff --git a/test/integration/grant-types/refresh-token-grant-type_test.js b/test/integration/grant-types/refresh-token-grant-type_test.js index 945d51c..83c7489 100644 --- a/test/integration/grant-types/refresh-token-grant-type_test.js +++ b/test/integration/grant-types/refresh-token-grant-type_test.js @@ -262,7 +262,7 @@ describe('RefreshTokenGrantType integration', function() { .then(should.fail) .catch(function(e) { e.should.be.an.instanceOf(InvalidGrantError); - e.message.should.equal('Invalid grant: refresh token is invalid'); + e.message.should.equal('Invalid grant: refresh token was issued to another client'); }); }); @@ -304,7 +304,7 @@ describe('RefreshTokenGrantType integration', function() { .then(should.fail) .catch(function(e) { e.should.be.an.instanceOf(InvalidGrantError); - e.message.should.equal('Invalid grant: refresh token is invalid'); + e.message.should.equal('Invalid grant: refresh token was issued to another client'); }); });