Skip to content

Commit c516c16

Browse files
authored
Merge pull request #524 from oauthjs/revert-501-dev
Revert "fix; correct client ID check in refresh_token grant type"
2 parents c6a3137 + 653a92b commit c516c16

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ RefreshTokenGrantType.prototype.getRefreshToken = function(request, client) {
100100
throw new ServerError('Server error: `getRefreshToken()` did not return a `user` object');
101101
}
102102

103-
if (token.client.id !== client.clientId) {
103+
if (token.client.id !== client.id) {
104104
throw new InvalidGrantError('Invalid grant: refresh token is invalid');
105105
}
106106

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ describe('RefreshTokenGrantType integration', function() {
112112
});
113113

114114
it('should return a token', function() {
115-
var client = { clientId: 123 };
115+
var client = { id: 123 };
116116
var token = { accessToken: 'foo', client: { id: 123 }, user: {} };
117117
var model = {
118118
getRefreshToken: function() { return token; },
@@ -130,7 +130,7 @@ describe('RefreshTokenGrantType integration', function() {
130130
});
131131

132132
it('should support promises', function() {
133-
var client = { clientId: 123 };
133+
var client = { id: 123 };
134134
var model = {
135135
getRefreshToken: function() { return Promise.resolve({ accessToken: 'foo', client: { id: 123 }, user: {} }); },
136136
revokeToken: function() { return Promise.resolve({ accessToken: 'foo', client: {}, refreshTokenExpiresAt: new Date(new Date() / 2), user: {} }); },
@@ -143,7 +143,7 @@ describe('RefreshTokenGrantType integration', function() {
143143
});
144144

145145
it('should support non-promises', function() {
146-
var client = { clientId: 123 };
146+
var client = { id: 123 };
147147
var model = {
148148
getRefreshToken: function() { return { accessToken: 'foo', client: { id: 123 }, user: {} }; },
149149
revokeToken: function() { return { accessToken: 'foo', client: {}, refreshTokenExpiresAt: new Date(new Date() / 2), user: {} }; },
@@ -156,7 +156,7 @@ describe('RefreshTokenGrantType integration', function() {
156156
});
157157

158158
it('should support callbacks', function() {
159-
var client = { clientId: 123 };
159+
var client = { id: 123 };
160160
var model = {
161161
getRefreshToken: function(refreshToken, callback) { callback(null, { accessToken: 'foo', client: { id: 123 }, user: {} }); },
162162
revokeToken: function(refreshToken, callback) { callback(null, { accessToken: 'foo', client: {}, refreshTokenExpiresAt: new Date(new Date() / 2), user: {} }); },
@@ -191,7 +191,7 @@ describe('RefreshTokenGrantType integration', function() {
191191
});
192192

193193
it('should throw an error if `refreshToken` is not found', function() {
194-
var client = { clientId: 123 };
194+
var client = { id: 123 };
195195
var model = {
196196
getRefreshToken: function() { return; },
197197
revokeToken: function() {},
@@ -247,7 +247,7 @@ describe('RefreshTokenGrantType integration', function() {
247247
});
248248

249249
it('should throw an error if the client id does not match', function() {
250-
var client = { clientId: 123 };
250+
var client = { id: 123 };
251251
var model = {
252252
getRefreshToken: function() {
253253
return { accessToken: 'foo', client: { id: 456 }, user: {} };
@@ -309,7 +309,7 @@ describe('RefreshTokenGrantType integration', function() {
309309
});
310310

311311
it('should throw an error if `refresh_token` is expired', function() {
312-
var client = { clientId: 123 };
312+
var client = { id: 123 };
313313
var date = new Date(new Date() / 2);
314314
var model = {
315315
getRefreshToken: function() {
@@ -330,7 +330,7 @@ describe('RefreshTokenGrantType integration', function() {
330330
});
331331

332332
it('should throw an error if `refreshTokenExpiresAt` is not a date value', function() {
333-
var client = { clientId: 123 };
333+
var client = { id: 123 };
334334
var model = {
335335
getRefreshToken: function() {
336336
return { accessToken: 'foo', client: { id: 123 }, refreshTokenExpiresAt: 'stringvalue', user: {} };
@@ -350,7 +350,7 @@ describe('RefreshTokenGrantType integration', function() {
350350
});
351351

352352
it('should return a token', function() {
353-
var client = { clientId: 123 };
353+
var client = { id: 123 };
354354
var token = { accessToken: 'foo', client: { id: 123 }, user: {} };
355355
var model = {
356356
getRefreshToken: function() { return token; },
@@ -368,7 +368,7 @@ describe('RefreshTokenGrantType integration', function() {
368368
});
369369

370370
it('should support promises', function() {
371-
var client = { clientId: 123 };
371+
var client = { id: 123 };
372372
var token = { accessToken: 'foo', client: { id: 123 }, user: {} };
373373
var model = {
374374
getRefreshToken: function() { return Promise.resolve(token); },
@@ -382,7 +382,7 @@ describe('RefreshTokenGrantType integration', function() {
382382
});
383383

384384
it('should support non-promises', function() {
385-
var client = { clientId: 123 };
385+
var client = { id: 123 };
386386
var token = { accessToken: 'foo', client: { id: 123 }, user: {} };
387387
var model = {
388388
getRefreshToken: function() { return token; },
@@ -396,7 +396,7 @@ describe('RefreshTokenGrantType integration', function() {
396396
});
397397

398398
it('should support callbacks', function() {
399-
var client = { clientId: 123 };
399+
var client = { id: 123 };
400400
var token = { accessToken: 'foo', client: { id: 123 }, user: {} };
401401
var model = {
402402
getRefreshToken: function(refreshToken, callback) { callback(null, token); },

0 commit comments

Comments
 (0)