Skip to content

Commit

Permalink
fix(auth0): ensure user_id is set in user profile
Browse files Browse the repository at this point in the history
fixes #476
  • Loading branch information
evansiroky committed Sep 18, 2019
1 parent 17ea531 commit 7f75723
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/common/user/Auth0Manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ class Auth0Manager {
profile.accessToken = accessToken
// set data expiration timestamp to be 60 seconds into the future
profile.dataExpirationTimestamp = (new Date()).getTime() + 60000
// The user_id might not be provided in certain cases, so try to use
// the `sub` field instead.
// See https://community.auth0.com/t/missing-user-id-from-user-profile/11457/7
profile.user_id = profile.user_id || profile.sub
if (!profile.user_id) {
return reject(new Error('Could not determine user_id for user!'))
}
setProfile(profile)
resolve(profile)
}
Expand Down

0 comments on commit 7f75723

Please sign in to comment.