session-sync-auth-site 0.3.0 → 0.3.1

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "session-sync-auth-site",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "main": "src/index.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -67,9 +67,14 @@ const setUpSessionSyncAuthRoutes = ({
67
67
  return res.redirect(noLoginRedirectUrl || redirectUrl)
68
68
  }
69
69
 
70
+ const {
71
+ userTableColNameMap,
72
+ } = req.sessionSyncAuthSiteOptions
73
+
74
+ mapKeys
70
75
  const jwtData = jwt.sign(
71
76
  {
72
- userId: req.user.id,
77
+ userId: req.user[userTableColNameMap.id || `id`],
73
78
  redirectUrl,
74
79
  },
75
80
  jwtSecret,
@@ -87,14 +92,14 @@ const setUpSessionSyncAuthRoutes = ({
87
92
  if(!global.sessionSyncAuthSiteConnection) {
88
93
  throw new Error('You must include the authenticate() middleware prior to calling setUpSessionSyncAuthRoutes.')
89
94
  }
90
-
95
+
91
96
  const {
92
97
  userTableName,
93
98
  sessionTableName,
94
99
  userTableColNameMap,
95
100
  sessionTableColNameMap,
96
101
  } = req.sessionSyncAuthSiteOptions
97
-
102
+
98
103
  const { users } = jwt.verify(payload, jwtSecret)
99
104
 
100
105
  if(!users) throw "Invalid payload. Missing `payload.user`."