Skip to content

Commit de3f039

Browse files
authored
Merge pull request #143 from chrisfranko/development
RefreshTokenGrant: update error messages
2 parents ac68291 + 19c8ced commit de3f039

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/grant-types/refresh-token-grant-type.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ RefreshTokenGrantType.prototype.getRefreshToken = function(request, client) {
101101
}
102102

103103
if (token.client.id !== client.id) {
104-
throw new InvalidGrantError('Invalid grant: refresh token is invalid');
104+
throw new InvalidGrantError('Invalid grant: refresh token was issued to another client');
105105
}
106106

107107
if (token.refreshTokenExpiresAt && !(token.refreshTokenExpiresAt instanceof Date)) {
@@ -130,7 +130,7 @@ RefreshTokenGrantType.prototype.revokeToken = function(token) {
130130
return promisify(this.model.revokeToken, 1).call(this.model, token)
131131
.then(function(status) {
132132
if (!status) {
133-
throw new InvalidGrantError('Invalid grant: refresh token is invalid');
133+
throw new InvalidGrantError('Invalid grant: refresh token is invalid or could not be revoked');
134134
}
135135

136136
return token;

test/integration/grant-types/refresh-token-grant-type_test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ describe('RefreshTokenGrantType integration', function() {
262262
.then(should.fail)
263263
.catch(function(e) {
264264
e.should.be.an.instanceOf(InvalidGrantError);
265-
e.message.should.equal('Invalid grant: refresh token is invalid');
265+
e.message.should.equal('Invalid grant: refresh token was issued to another client');
266266
});
267267
});
268268

@@ -304,7 +304,7 @@ describe('RefreshTokenGrantType integration', function() {
304304
.then(should.fail)
305305
.catch(function(e) {
306306
e.should.be.an.instanceOf(InvalidGrantError);
307-
e.message.should.equal('Invalid grant: refresh token is invalid');
307+
e.message.should.equal('Invalid grant: refresh token was issued to another client');
308308
});
309309
});
310310

0 commit comments

Comments
 (0)