移除 cookie 的 secure 属性
This commit is contained in:
@@ -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,
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user