移除 cookie 的 secure 属性

This commit is contained in:
2025-04-22 11:31:41 +08:00
parent 4c0fc8be6a
commit 38ca97f3ba
5 changed files with 0 additions and 18 deletions

View File

@@ -40,25 +40,21 @@ export async function login(props: LoginParams): Promise<ApiResponse> {
cookieStore.set('auth_token', data.access_token, {
httpOnly: true,
sameSite: 'strict',
secure: process.env.NODE_ENV === 'production',
maxAge: Math.max(future, 0),
})
cookieStore.set('auth_refresh', data.refresh_token, {
httpOnly: true,
sameSite: 'strict',
secure: process.env.NODE_ENV === 'production',
maxAge: 7 * 24 * 3600,
})
cookieStore.set('auth_info', JSON.stringify(data.auth), {
httpOnly: true,
sameSite: 'strict',
secure: process.env.NODE_ENV === 'production',
maxAge: 7 * 24 * 3600,
})
cookieStore.set('auth_profile', JSON.stringify(data.profile), {
httpOnly: true,
sameSite: 'strict',
secure: process.env.NODE_ENV === 'production',
maxAge: 7 * 24 * 3600,
})
@@ -85,25 +81,21 @@ export async function logout() {
cookieStore.set('auth_token', '', {
httpOnly: true,
sameSite: 'strict',
secure: process.env.NODE_ENV === 'production',
maxAge: -1,
})
cookieStore.set('auth_refresh', '', {
httpOnly: true,
sameSite: 'strict',
secure: process.env.NODE_ENV === 'production',
maxAge: -1,
})
cookieStore.set('auth_info', '', {
httpOnly: true,
sameSite: 'strict',
secure: process.env.NODE_ENV === 'production',
maxAge: -1,
})
cookieStore.set('auth_profile', '', {
httpOnly: true,
sameSite: 'strict',
secure: process.env.NODE_ENV === 'production',
maxAge: -1,
})
@@ -140,7 +132,6 @@ export async function getProfile(refresh: boolean = false) {
cookie.set('auth_profile', JSON.stringify(result.data), {
httpOnly: true,
sameSite: 'strict',
secure: process.env.NODE_ENV === 'production',
maxAge: 7 * 24 * 3600,
})