Skip to content

Commit

Permalink
Merge pull request #206 from rolodato/popup-without-idtoken
Browse files Browse the repository at this point in the history
Fix popup mode when no id_token is returned
  • Loading branch information
hzalaz authored Sep 22, 2016
2 parents dbe1663 + a5b3463 commit 3e62577
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ Auth0.prototype.loginWithPopup = function(options, callback) {
}

// Handle profile retrieval from id_token and respond
if (result.id_token) {
if (result.access_token || result.id_token) {
return callback(null, _this._prepareResult(result));
}

Expand Down Expand Up @@ -1926,14 +1926,12 @@ Auth0.prototype._prepareResult = function(result) {
return;
}

var idTokenPayload = result.profile
? result.profile
: this.decodeJwt(result.id_token);
var decodedIdToken = result.id_token ? this.decodeJwt(result.id_token) : undefined;

return {
accessToken: result.access_token,
idToken: result.id_token,
idTokenPayload: idTokenPayload,
idTokenPayload: result.profile || decodedIdToken,
refreshToken: result.refresh_token,
state: result.state
};
Expand Down

0 comments on commit 3e62577

Please sign in to comment.