mirror of
https://github.com/lukevella/rallly.git
synced 2025-07-20 09:47:21 +02:00
🐛 Only migrate legacy token if nextauth token doesn’t exist
This commit is contained in:
parent
1e93a4f65b
commit
25da819774
1 changed files with 23 additions and 20 deletions
|
@ -42,6 +42,7 @@ export default withAuth(
|
|||
|
||||
const res = NextResponse.rewrite(newUrl);
|
||||
|
||||
if (!req.nextauth.token) {
|
||||
/**
|
||||
* We moved from a bespoke session implementation to next-auth.
|
||||
* This middleware looks for the old session cookie and moves it to
|
||||
|
@ -62,9 +63,11 @@ export default withAuth(
|
|||
res.cookies.set({
|
||||
name: "legacy-token",
|
||||
value: legacyToken.value,
|
||||
httpOnly: false,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue