Skip to content
This repository was archived by the owner on Mar 3, 2022. It is now read-only.

Commit d95e47a

Browse files
committed
include all response values in signin response
1 parent defaadb commit d95e47a

File tree

4 files changed

+13
-19
lines changed

4 files changed

+13
-19
lines changed

index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,8 @@ export class User {
406406
expires_at: number;
407407
/** The custom state transferred in the last signin */
408408
state: any;
409-
/** Other claims sent in the token response */
410-
otherClaims: Record<string, any>;
409+
/** Other values sent in the token response */
410+
otherValues: Record<string, any>;
411411

412412
toStorageString(): string;
413413
static fromStorageString(storageString: string): User;

src/ResponseValidator.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,10 @@ export class ResponseValidator {
259259

260260
return this._tokenClient.exchangeCode(request).then(tokenResponse => {
261261

262-
for(var key in tokenResponse) {
263-
response[key] = tokenResponse[key];
262+
for (var key in tokenResponse) {
263+
if (Object.prototype.hasOwnProperty.call(tokenResponse, key)) {
264+
response[key] = tokenResponse[key];
265+
}
264266
}
265267

266268
if (response.id_token) {

src/SigninResponse.js

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,12 @@ export class SigninResponse {
1010

1111
var values = UrlUtility.parseUrlFragment(url, delimiter);
1212

13-
this.error = values.error;
14-
this.error_description = values.error_description;
15-
this.error_uri = values.error_uri;
16-
17-
this.code = values.code;
18-
this.state = values.state;
19-
this.id_token = values.id_token;
20-
this.session_state = values.session_state;
21-
this.access_token = values.access_token;
22-
this.token_type = values.token_type;
23-
this.scope = values.scope;
13+
for (var key in values) {
14+
if (Object.prototype.hasOwnProperty.call(values, key)) {
15+
this[key] = values[key];
16+
}
17+
}
2418
this.profile = undefined; // will be set from ResponseValidator
25-
26-
this.expires_in = values.expires_in;
2719
}
2820

2921
get expires_in() {

src/User.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import { Log } from './Log.js';
55

66
export class User {
7-
constructor({id_token, session_state, access_token, refresh_token, token_type, scope, profile, expires_at, state, ...otherClaims}) {
7+
constructor({id_token, session_state, access_token, refresh_token, token_type, scope, profile, expires_at, state, ...otherValues}) {
88
this.id_token = id_token;
99
this.session_state = session_state;
1010
this.access_token = access_token;
@@ -14,7 +14,7 @@ export class User {
1414
this.profile = profile;
1515
this.expires_at = expires_at;
1616
this.state = state;
17-
this.otherClaims = otherClaims;
17+
this.otherValues = otherValues;
1818
}
1919

2020
get expires_in() {

0 commit comments

Comments
 (0)