Skip to content

Commit a82aea7

Browse files
committed
feat: increase session cookie maxage
1 parent 40269ad commit a82aea7

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

proxy.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,10 @@ export async function proxy(request: NextRequest) {
4242
const newIdToken = data.id_token
4343
const newRefreshToken = data.refresh_token
4444

45-
const decodedToken = await auth.verifyIdToken(newIdToken)
46-
const expiresIn = decodedToken.exp * 1000 - Date.now()
47-
4845
const response = NextResponse.next()
4946

5047
response.cookies.set(sessionName, newIdToken, {
51-
maxAge: Math.floor(expiresIn / 1000),
48+
maxAge: 30 * 24 * 60 * 60, // 30 days
5249
httpOnly: true,
5350
secure: true,
5451
sameSite: 'strict',
@@ -101,13 +98,10 @@ export async function proxy(request: NextRequest) {
10198
const newIdToken = data.id_token
10299
const newRefreshToken = data.refresh_token
103100

104-
const decodedToken = await auth.verifyIdToken(newIdToken)
105-
const expiresIn = decodedToken.exp * 1000 - Date.now()
106-
107101
const response = NextResponse.next()
108102

109103
response.cookies.set(sessionName, newIdToken, {
110-
maxAge: Math.floor(expiresIn / 1000),
104+
maxAge: 30 * 24 * 60 * 60, // 30 days
111105
httpOnly: true,
112106
secure: true,
113107
sameSite: 'strict',

0 commit comments

Comments
 (0)