Skip to content

Commit ff54089

Browse files
Minor refactor of Session.fromAuthResponse()
1 parent 0f52cef commit ff54089

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/Session.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ class Session {
4545
/**
4646
* @param response {AuthenticationResponse}
4747
*
48-
* @returns {Session}
48+
* @returns {Session} RelyingParty Session object
4949
*/
5050
static fromAuthResponse (response) {
5151
const RelyingParty = require('./RelyingParty') // import here due to circular dep
5252

53-
let payload = response.decoded.payload
53+
let idClaims = response.decoded && response.decoded.payload || {}
5454

5555
let { rp } = response
5656

@@ -65,14 +65,14 @@ class Session {
6565
let options = {
6666
credentialType,
6767
sessionKey,
68-
issuer: payload.iss,
68+
issuer: idClaims.iss,
69+
idClaims,
6970
authorization: {
7071
client_id: registration['client_id'],
7172
access_token: response.params['access_token'],
7273
id_token: response.params['id_token'],
7374
refresh_token: response.params['refresh_token']
74-
},
75-
idClaims: response.decoded && response.decoded.payload,
75+
}
7676
}
7777

7878
return Session.from(options)

0 commit comments

Comments
 (0)