fix: stale session after logging into CLI

This commit is contained in:
Daniel Hougaard
2024-09-09 23:15:58 +04:00
parent 2b39d9e6c4
commit e6c0bbb25b
5 changed files with 19 additions and 14 deletions
+3 -2
View File
@@ -42,7 +42,8 @@ export const registerLoginRouter = async (server: FastifyZodProvider) => {
},
schema: {
body: z.object({
organizationId: z.string().trim()
organizationId: z.string().trim(),
customUserAgent: z.enum(["cli"]).optional()
}),
response: {
200: z.object({
@@ -53,7 +54,7 @@ export const registerLoginRouter = async (server: FastifyZodProvider) => {
handler: async (req, res) => {
const cfg = getConfig();
const tokens = await server.services.login.selectOrganization({
userAgent: req.headers["user-agent"],
userAgent: req.body.customUserAgent ?? req.headers["user-agent"],
authJwtToken: req.headers.authorization,
organizationId: req.body.organizationId,
ipAddress: req.realIp