session-sync-auth-site 0.5.2 → 0.5.4

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/README.md CHANGED
@@ -116,7 +116,7 @@ app.post(`get-login-link`, (req, res, next) => {
116
116
  const loginLink = await getLoginLink({
117
117
  email: req.body.email,
118
118
  redirectUrl: req.body.redirectUrl, // must begin with the frontend domain (default: req.headers.origin)
119
- origin: `https://my-backend-domain.com`, // default: req.headers.origin
119
+ origin: `https://my-backend-domain.com`, // default: `${req.protocol}://${req.headers.host}`
120
120
  req,
121
121
  })
122
122
  res.send({ loginLink })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "session-sync-auth-site",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "main": "src/index.js",
5
5
  "repository": {
6
6
  "type": "git",
package/src/createUser.js CHANGED
@@ -11,7 +11,7 @@ const createUser = async ({
11
11
  siteId,
12
12
  authDomain,
13
13
  jwtSecret,
14
- protocol=req.sessionSyncAuthProtocol || `https`,
14
+ protocol=(setup || req).sessionSyncAuthProtocol || `https`,
15
15
  } = setup || await req.getSessionSyncAuthSetupInfo()
16
16
 
17
17
  const createUserResult = await fetch(
@@ -4,13 +4,13 @@ const jwt = require('jsonwebtoken')
4
4
  const getLoginLink = async ({
5
5
  email,
6
6
  redirectUrl, // defaults to req.headers.origin
7
- origin, // defaults to req.headers.origin
7
+ origin, // defaults to `${req.protocol}://${req.headers.host}`
8
8
  req, // either this or `setup` is required
9
9
  setup, // keys: siteId, authDomain, and jwtSecret
10
10
  }={}) => {
11
11
 
12
12
  redirectUrl = redirectUrl || req.headers.origin
13
- origin = origin || req.headers.origin
13
+ origin = origin || `${req.protocol}://${req.headers.host}`
14
14
 
15
15
  const {
16
16
  siteId,