session-sync-auth-site 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -67,9 +67,13 @@ const setUpSessionSyncAuthRoutes = ({
|
|
|
67
67
|
return res.redirect(noLoginRedirectUrl || redirectUrl)
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
const {
|
|
71
|
+
userTableColNameMap,
|
|
72
|
+
} = req.sessionSyncAuthSiteOptions
|
|
73
|
+
|
|
70
74
|
const jwtData = jwt.sign(
|
|
71
75
|
{
|
|
72
|
-
userId: req.user.id,
|
|
76
|
+
userId: req.user[userTableColNameMap.id || `id`],
|
|
73
77
|
redirectUrl,
|
|
74
78
|
},
|
|
75
79
|
jwtSecret,
|
|
@@ -87,14 +91,14 @@ const setUpSessionSyncAuthRoutes = ({
|
|
|
87
91
|
if(!global.sessionSyncAuthSiteConnection) {
|
|
88
92
|
throw new Error('You must include the authenticate() middleware prior to calling setUpSessionSyncAuthRoutes.')
|
|
89
93
|
}
|
|
90
|
-
|
|
94
|
+
|
|
91
95
|
const {
|
|
92
96
|
userTableName,
|
|
93
97
|
sessionTableName,
|
|
94
98
|
userTableColNameMap,
|
|
95
99
|
sessionTableColNameMap,
|
|
96
100
|
} = req.sessionSyncAuthSiteOptions
|
|
97
|
-
|
|
101
|
+
|
|
98
102
|
const { users } = jwt.verify(payload, jwtSecret)
|
|
99
103
|
|
|
100
104
|
if(!users) throw "Invalid payload. Missing `payload.user`."
|