Next.js sample application that integrates with the mock SSO service: redirects to sso-mock for login, receives the one-time sso_code on its /callback route, and exchanges it for user info to establish a session. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
16 lines
408 B
TypeScript
16 lines
408 B
TypeScript
import { NextResponse } from 'next/server'
|
|
|
|
/**
|
|
* 退出登录
|
|
* 清除所有认证相关 Cookie。
|
|
*/
|
|
export async function POST() {
|
|
const response = NextResponse.json({ success: true })
|
|
|
|
response.cookies.set('user', '', { path: '/', maxAge: 0 })
|
|
response.cookies.set('token', '', { path: '/', maxAge: 0 })
|
|
response.cookies.set('refresh_token', '', { path: '/', maxAge: 0 })
|
|
|
|
return response
|
|
}
|