This commit is contained in:
2026-08-18 10:52:03 +00:00
parent 59ee8f56a8
commit 337b397772
2 changed files with 7 additions and 3 deletions
+6 -2
View File
@@ -126,16 +126,20 @@ export async function handleCallback(): Promise<boolean> {
const code = url.searchParams.get('code');
const state = url.searchParams.get('state');
console.log('[Logto Callback] Recebido:', { hasCode: !!code, hasState: !!state });
if (!code) return false;
const expectedState = sessionStorage.getItem('logto_state');
const verifier = sessionStorage.getItem('logto_verifier') || '';
console.log('[Logto Callback] State match?', { received: state, expected: expectedState, hasVerifier: !!verifier });
if (state !== expectedState) {
console.error('Logto: state mismatch');
return false;
}
const verifier = sessionStorage.getItem('logto_verifier') || '';
const body = new URLSearchParams({
grant_type: 'authorization_code',
client_id: APP_ID,