fix: pass full URL to handleSignIn for callback URI matching
The Logto SDK needs the full callback URL (not just searchParams) to verify it matches the redirect URI registered during sign-in. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
f786947941
commit
9933c3678e
1 changed files with 5 additions and 2 deletions
|
|
@ -6,7 +6,10 @@ import { type NextRequest } from 'next/server';
|
|||
export const dynamic = 'force-dynamic';
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const searchParams = request.nextUrl.searchParams;
|
||||
await handleSignIn(logtoConfig, searchParams);
|
||||
const callbackUrl = new URL(
|
||||
`/api/logto/callback?${request.nextUrl.searchParams.toString()}`,
|
||||
logtoConfig.baseUrl
|
||||
);
|
||||
await handleSignIn(logtoConfig, callbackUrl);
|
||||
redirect('/');
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue