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

Commit 682e89a

Browse files
committed
Fix for linked account information bug
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.
1 parent cadc19c commit 682e89a

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

next-auth.functions.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,14 @@ module.exports = () => {
122122
},
123123
// Seralize turns the value of the ID key from a User object
124124
serialize: (user) => {
125-
return Promise.resolve(user._id)
125+
// Supports serialization from Mongo Object *and* deserialize() object
126+
if (user.id) {
127+
return Promise.resolve(user.id)
128+
} else if (user._id) {
129+
return Promise.resolve(user._id)
130+
} else {
131+
return Promise.reject(new Error("Unable to serialise user"))
132+
}
126133
},
127134
// Deseralize turns a User ID into a normalized User object that is
128135
// exported to clients. It should not return private/sensitive fields.

npm-shrinkwrap.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"mongodb": "^2.2.31",
2323
"nedb": "^1.8.0",
2424
"next": "^4.2.1",
25-
"next-auth": "^1.1.1",
25+
"next-auth": "^1.1.5",
2626
"next-auth-client": "^1.1.1",
2727
"node-sass": "^4.5.3",
2828
"nodemailer": "^4.0.1",

0 commit comments

Comments
 (0)