Login, logout and middleware updates
This commit is contained in:
parent
f552f8024f
commit
9fb3665ced
18 changed files with 96 additions and 50 deletions
|
|
@ -110,7 +110,7 @@ export const authOptions: NextAuthOptions = {
|
|||
},
|
||||
providers,
|
||||
session: {
|
||||
maxAge: 7 * 24 * 60 * 60,
|
||||
maxAge: 3 * 24 * 60 * 60,
|
||||
},
|
||||
secret: process.env.NEXTAUTH_SECRET,
|
||||
callbacks: {
|
||||
|
|
|
|||
|
|
@ -1,19 +1,12 @@
|
|||
import { getServerSession } from "app/_lib/authentication";
|
||||
import { cookies, headers } from "next/headers";
|
||||
import crypto from "crypto";
|
||||
import { cookies } from "next/headers";
|
||||
|
||||
const getHeaders = async () => {
|
||||
const userAgent = (await headers()).get("user-agent");
|
||||
const allCookies = (await cookies()).getAll();
|
||||
const hashedUserAgent = crypto
|
||||
.createHash("sha256")
|
||||
.update(userAgent)
|
||||
.digest("hex");
|
||||
const session = await getServerSession();
|
||||
const finalHeaders = {
|
||||
"Content-Type": "application/json",
|
||||
Accept: "application/json",
|
||||
"X-Browser-Fingerprint": hashedUserAgent,
|
||||
// @ts-ignore
|
||||
"X-CSRF-Token": session.user.zammadCsrfToken,
|
||||
Cookie: allCookies
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue