-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
111 additions
and
95 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { NextRequest } from 'next/server'; | ||
import AuthService from '@/services/auth/authService'; | ||
|
||
const ACCESS_TOKEN_COOKIE = 'AUTH_CONTEXT'; | ||
const REFRESH_TOKEN_COOKIE = 'AUTH_PERSIST'; | ||
|
||
export async function GET(req: NextRequest) { | ||
const domain = req.headers.get('host')?.split(':')[0]; | ||
const headers: HeadersInit = new Headers(); | ||
headers.append('Set-Cookie', `${ACCESS_TOKEN_COOKIE}=; Domain=${domain}; Path=/; Max-Age=0; SameSite=Lax; HttpOnly`); | ||
headers.append('Set-Cookie', `${REFRESH_TOKEN_COOKIE}=; Domain=${domain}; Path=/; Max-Age=0; SameSite=Lax; HttpOnly`); | ||
|
||
//await AuthService.logout(); | ||
|
||
const redirectUrl = new URL(req.nextUrl.origin); | ||
redirectUrl.searchParams.append('logout', ''); | ||
|
||
//return NextResponse.redirect(req.nextUrl.origin, { status: HttpStatusCode.PermanentRedirect, headers }); | ||
return Response.json({ message: redirectUrl.toString() }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters