Skip to content

Commit 227ac49

Browse files
committed
fix: redirect on refresh
1 parent a82aea7 commit 227ac49

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

proxy.ts

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

45-
const response = NextResponse.next()
45+
// Redirect to the same URL to apply fresh cookies
46+
const response = NextResponse.redirect(request.url)
4647

4748
response.cookies.set(sessionName, newIdToken, {
4849
maxAge: 30 * 24 * 60 * 60, // 30 days
@@ -98,7 +99,8 @@ export async function proxy(request: NextRequest) {
9899
const newIdToken = data.id_token
99100
const newRefreshToken = data.refresh_token
100101

101-
const response = NextResponse.next()
102+
// Redirect to the same URL to apply fresh cookies
103+
const response = NextResponse.redirect(request.url)
102104

103105
response.cookies.set(sessionName, newIdToken, {
104106
maxAge: 30 * 24 * 60 * 60, // 30 days

0 commit comments

Comments
 (0)