Skip to content
This repository has been archived by the owner on Jul 15, 2020. It is now read-only.

Commit

Permalink
Fix for linked account information bug
Browse files Browse the repository at this point in the history
Somtimes linked accounts were being displayed incorrectly.

The seralisation code has been updated to fix this with both Mongo DB and NeDB (used when no Mongo DB is configured).

NextAuth also has an update to it’s error handling to reduce future errors so have updated the dependancy.
  • Loading branch information
iaincollins committed Jan 27, 2018
1 parent cadc19c commit 682e89a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
9 changes: 8 additions & 1 deletion next-auth.functions.js
Expand Up @@ -122,7 +122,14 @@ module.exports = () => {
},
// Seralize turns the value of the ID key from a User object
serialize: (user) => {
return Promise.resolve(user._id)
// Supports serialization from Mongo Object *and* deserialize() object
if (user.id) {
return Promise.resolve(user.id)
} else if (user._id) {
return Promise.resolve(user._id)
} else {
return Promise.reject(new Error("Unable to serialise user"))
}
},
// Deseralize turns a User ID into a normalized User object that is
// exported to clients. It should not return private/sensitive fields.
Expand Down
8 changes: 4 additions & 4 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -22,7 +22,7 @@
"mongodb": "^2.2.31",
"nedb": "^1.8.0",
"next": "^4.2.1",
"next-auth": "^1.1.1",
"next-auth": "^1.1.5",
"next-auth-client": "^1.1.1",
"node-sass": "^4.5.3",
"nodemailer": "^4.0.1",
Expand Down

0 comments on commit 682e89a

Please sign in to comment.