aaa
This commit is contained in:
@@ -126,16 +126,20 @@ export async function handleCallback(): Promise<boolean> {
|
|||||||
const code = url.searchParams.get('code');
|
const code = url.searchParams.get('code');
|
||||||
const state = url.searchParams.get('state');
|
const state = url.searchParams.get('state');
|
||||||
|
|
||||||
|
console.log('[Logto Callback] Recebido:', { hasCode: !!code, hasState: !!state });
|
||||||
|
|
||||||
if (!code) return false;
|
if (!code) return false;
|
||||||
|
|
||||||
const expectedState = sessionStorage.getItem('logto_state');
|
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) {
|
if (state !== expectedState) {
|
||||||
console.error('Logto: state mismatch');
|
console.error('Logto: state mismatch');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const verifier = sessionStorage.getItem('logto_verifier') || '';
|
|
||||||
|
|
||||||
const body = new URLSearchParams({
|
const body = new URLSearchParams({
|
||||||
grant_type: 'authorization_code',
|
grant_type: 'authorization_code',
|
||||||
client_id: APP_ID,
|
client_id: APP_ID,
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ const Callback = () => {
|
|||||||
} else {
|
} else {
|
||||||
setStatus('error');
|
setStatus('error');
|
||||||
setMessage('Falha no login. Tente novamente.');
|
setMessage('Falha no login. Tente novamente.');
|
||||||
setTimeout(() => navigate('/auth'), 2500);
|
// Não navega automaticamente - deixa o user ver o erro
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (cancelled) return;
|
if (cancelled) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user