mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-12 12:04:16 +00:00
use server_token header
This commit is contained in:
parent
24d7038191
commit
bcd1735fcd
@ -12,7 +12,7 @@ import routes from "./routes"
|
|||||||
const mainAPI = axios.create({
|
const mainAPI = axios.create({
|
||||||
baseURL: process.env.MAIN_API_URL ?? "http://localhost:3010",
|
baseURL: process.env.MAIN_API_URL ?? "http://localhost:3010",
|
||||||
headers: {
|
headers: {
|
||||||
"server_token": `${process.env.MAIN_SERVER_ID}:${process.env.MAIN_SERVER_TOKEN}`,
|
server_token: `${process.env.MAIN_SERVER_ID}:${process.env.MAIN_SERVER_TOKEN}`,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
"formidable": "^2.1.1",
|
"formidable": "^2.1.1",
|
||||||
"jimp": "^0.16.2",
|
"jimp": "^0.16.2",
|
||||||
"jsonwebtoken": "^9.0.0",
|
"jsonwebtoken": "^9.0.0",
|
||||||
"linebridge": "0.15.7",
|
"linebridge": "0.15.8",
|
||||||
"luxon": "^3.2.1",
|
"luxon": "^3.2.1",
|
||||||
"mime-types": "^2.1.35",
|
"mime-types": "^2.1.35",
|
||||||
"minio": "^7.0.32",
|
"minio": "^7.0.32",
|
||||||
|
@ -35,6 +35,8 @@ export default class API {
|
|||||||
require("@controllers"),
|
require("@controllers"),
|
||||||
require("@middlewares"),
|
require("@middlewares"),
|
||||||
{
|
{
|
||||||
|
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
|
||||||
|
"Access-Control-Allow-Headers": "Content-Type, Authorization, Content-Length, X-Requested-With, X-Access-Token, X-Refresh-Token, server_token",
|
||||||
"Access-Control-Expose-Headers": "regenerated_token",
|
"Access-Control-Expose-Headers": "regenerated_token",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -47,7 +49,7 @@ export default class API {
|
|||||||
|
|
||||||
jwtStrategy = global.jwtStrategy = {
|
jwtStrategy = global.jwtStrategy = {
|
||||||
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
|
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
|
||||||
secretOrKey: this.server.server_token,
|
secretOrKey: process.env.SERVER_TOKEN ?? "secret",
|
||||||
algorithms: ["sha1", "RS256", "HS256"],
|
algorithms: ["sha1", "RS256", "HS256"],
|
||||||
expiresIn: process.env.signLifetime ?? "1h",
|
expiresIn: process.env.signLifetime ?? "1h",
|
||||||
enforceRegenerationTokenExpiration: false,
|
enforceRegenerationTokenExpiration: false,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user