Skip to content

Commit 0571809

Browse files
committed
fix: remove npm-app's scary logout error message
1 parent c61ed31 commit 0571809

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

web/src/app/api/auth/cli/logout/route.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,14 @@ export async function POST(req: Request) {
3636
id: schema.session.sessionToken,
3737
})
3838

39+
// If no session was deleted, it means the token was already invalid or the user was already logged out.
40+
// This is effectively a no-op, so we treat it as a successful logout rather than an error.
3941
if (validDeletion.length === 0) {
40-
return NextResponse.json(
41-
{
42-
error: INVALID_AUTH_TOKEN_MESSAGE,
43-
},
44-
{ status: 401 }
42+
logger.info(
43+
{ fingerprintId },
44+
'Logout attempted with invalid/expired token - treating as successful no-op'
4545
)
46+
return NextResponse.json({ success: true })
4647
}
4748

4849
// Then reset sig_hash to null

0 commit comments

Comments
 (0)