mirror of
https://github.com/BradNut/node-auth
synced 2025-09-08 17:40:17 +00:00
Adding domain to env and referencing when creating cookies.
This commit is contained in:
parent
24c7442dfd
commit
e4adacf7c1
1 changed files with 3 additions and 2 deletions
|
|
@ -5,6 +5,7 @@ import { createTokens } from './tokens.js'
|
||||||
const { ObjectId } = mongo
|
const { ObjectId } = mongo
|
||||||
|
|
||||||
const JWTSignature = process.env.JWT_SIGNATURE
|
const JWTSignature = process.env.JWT_SIGNATURE
|
||||||
|
const { ROOT_DOMAIN } = process.env
|
||||||
|
|
||||||
export async function getUserFromCookies(request, reply) {
|
export async function getUserFromCookies(request, reply) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -58,13 +59,13 @@ export async function refreshTokens(sessionToken, userId, reply) {
|
||||||
reply
|
reply
|
||||||
.setCookie('refreshToken', refreshToken, {
|
.setCookie('refreshToken', refreshToken, {
|
||||||
path: "/",
|
path: "/",
|
||||||
domain: "localhost",
|
domain: ROOT_DOMAIN,
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
secure: true,
|
secure: true,
|
||||||
expires: refreshExpires,
|
expires: refreshExpires,
|
||||||
}).setCookie('accessToken', accessToken, {
|
}).setCookie('accessToken', accessToken, {
|
||||||
path: "/",
|
path: "/",
|
||||||
domain: "localhost",
|
domain: ROOT_DOMAIN,
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
secure: true,
|
secure: true,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue