mirror of
https://github.com/sasjs/server.git
synced 2026-01-11 00:10:06 +00:00
fix: change the expiration of access/refresh tokens from days to seconds
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import jwt from 'jsonwebtoken'
|
||||
import { InfoJWT } from '../types'
|
||||
import { NUMBER_OF_SECONDS_IN_A_DAY } from '../model/Client'
|
||||
|
||||
export const generateAccessToken = (data: InfoJWT, expiry?: number) =>
|
||||
jwt.sign(data, process.secrets.ACCESS_TOKEN_SECRET, {
|
||||
expiresIn: expiry ? `${expiry}d` : '1d'
|
||||
expiresIn: expiry ? expiry : NUMBER_OF_SECONDS_IN_A_DAY
|
||||
})
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import jwt from 'jsonwebtoken'
|
||||
import { InfoJWT } from '../types'
|
||||
import { NUMBER_OF_SECONDS_IN_A_DAY } from '../model/Client'
|
||||
|
||||
export const generateRefreshToken = (data: InfoJWT, expiry?: number) =>
|
||||
jwt.sign(data, process.secrets.REFRESH_TOKEN_SECRET, {
|
||||
expiresIn: expiry ? `${expiry}d` : '30d'
|
||||
expiresIn: expiry ? expiry : NUMBER_OF_SECONDS_IN_A_DAY
|
||||
})
|
||||
|
||||
@@ -89,8 +89,8 @@ export const registerClientValidation = (data: any): Joi.ValidationResult =>
|
||||
Joi.object({
|
||||
clientId: Joi.string().required(),
|
||||
clientSecret: Joi.string().required(),
|
||||
accessTokenExpiryDays: Joi.number(),
|
||||
refreshTokenExpiryDays: Joi.number()
|
||||
accessTokenExpiration: Joi.number(),
|
||||
refreshTokenExpiration: Joi.number()
|
||||
}).validate(data)
|
||||
|
||||
export const registerPermissionValidation = (data: any): Joi.ValidationResult =>
|
||||
|
||||
Reference in New Issue
Block a user