Skip to content

Commit 25c2c66

Browse files
committed
copy all token response values back
1 parent 8300c53 commit 25c2c66

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

src/ResponseValidator.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,16 +243,21 @@ export class ResponseValidator {
243243
};
244244

245245
return this._tokenClient.exchangeCode(request).then(tokenResponse => {
246-
if (tokenResponse.id_token) {
246+
247+
for(var key in tokenResponse) {
248+
response[key] = tokenResponse[key];
249+
}
250+
251+
if (response.id_token) {
247252
Log.debug("ResponseValidator._validateCode: token response successful, parsing id_token");
248-
var jwt = this._joseUtil.parseJwt(tokenResponse.id_token);
249-
tokenResponse.profile = jwt.payload;
253+
var jwt = this._joseUtil.parseJwt(response.id_token);
254+
response.profile = jwt.payload;
250255
}
251256
else {
252257
Log.debug("ResponseValidator._validateCode: token response successful, returning response");
253258
}
254259

255-
return tokenResponse;
260+
return response;
256261
});
257262
}
258263

src/SigninResponse.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,7 @@ export class SigninResponse {
2323
this.scope = values.scope;
2424
this.profile = undefined; // will be set from ResponseValidator
2525

26-
let expires_in = parseInt(values.expires_in);
27-
if (typeof expires_in === 'number' && expires_in > 0) {
28-
let now = parseInt(Date.now() / 1000);
29-
this.expires_at = now + expires_in;
30-
}
26+
this.expires_in = values.expires_in;
3127
}
3228

3329
get expires_in() {
@@ -37,6 +33,13 @@ export class SigninResponse {
3733
}
3834
return undefined;
3935
}
36+
set expires_in(value){
37+
let expires_in = parseInt(value);
38+
if (typeof expires_in === 'number' && expires_in > 0) {
39+
let now = parseInt(Date.now() / 1000);
40+
this.expires_at = now + expires_in;
41+
}
42+
}
4043

4144
get expired() {
4245
let expires_in = this.expires_in;

0 commit comments

Comments
 (0)