mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
make jwt expire time configurable like in the frontend
This commit is contained in:
parent
1066f67c5b
commit
a8b0699ebb
@ -10,6 +10,7 @@ SMTP_USERNAME=
|
|||||||
SMTP_PASSWORD=
|
SMTP_PASSWORD=
|
||||||
|
|
||||||
JWT_SECRET="b/&&7b78BF&fv/Vd"
|
JWT_SECRET="b/&&7b78BF&fv/Vd"
|
||||||
|
JWT_EXPIRES="2y"
|
||||||
MAPBOX_TOKEN="pk.eyJ1IjoiYnVzZmFrdG9yIiwiYSI6ImNraDNiM3JxcDBhaWQydG1uczhpZWtpOW4ifQ.7TNRTO-o9aK1Y6MyW_Nd4g"
|
MAPBOX_TOKEN="pk.eyJ1IjoiYnVzZmFrdG9yIiwiYSI6ImNraDNiM3JxcDBhaWQydG1uczhpZWtpOW4ifQ.7TNRTO-o9aK1Y6MyW_Nd4g"
|
||||||
|
|
||||||
PRIVATE_KEY_PASSPHRASE="a7dsf78sadg87ad87sfagsadg78"
|
PRIVATE_KEY_PASSPHRASE="a7dsf78sadg87ad87sfagsadg78"
|
||||||
|
|||||||
@ -35,6 +35,7 @@ const required = {
|
|||||||
const server = {
|
const server = {
|
||||||
CLIENT_URI: env.CLIENT_URI || 'http://localhost:3000',
|
CLIENT_URI: env.CLIENT_URI || 'http://localhost:3000',
|
||||||
GRAPHQL_URI: env.GRAPHQL_URI || 'http://localhost:4000',
|
GRAPHQL_URI: env.GRAPHQL_URI || 'http://localhost:4000',
|
||||||
|
JWT_EXPIRES: env.JWT_EXPIRES || '2y',
|
||||||
}
|
}
|
||||||
|
|
||||||
const smtp = {
|
const smtp = {
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import CONFIG from './../config'
|
|||||||
export default function encode(user) {
|
export default function encode(user) {
|
||||||
const { id, name, slug } = user
|
const { id, name, slug } = user
|
||||||
const token = jwt.sign({ id, name, slug }, CONFIG.JWT_SECRET, {
|
const token = jwt.sign({ id, name, slug }, CONFIG.JWT_SECRET, {
|
||||||
expiresIn: '2y',
|
expiresIn: CONFIG.JWT_EXPIRES,
|
||||||
issuer: CONFIG.GRAPHQL_URI,
|
issuer: CONFIG.GRAPHQL_URI,
|
||||||
audience: CONFIG.CLIENT_URI,
|
audience: CONFIG.CLIENT_URI,
|
||||||
subject: user.id.toString(),
|
subject: user.id.toString(),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user