[Python] react-native-passkey: Error: The incoming request cannot be validated

Discussão em 'Python' iniciado por Stack, Maio 5, 2025.

  1. Stack

    Stack Membro Participativo

    I’m using react-native-passkey to implement Passkey auth—any ideas why Android reports “incoming request cannot be validated”?

    • Debugging/development environment:

    Android 13 (physical device with Metro)

    Server (Python Flask on local PC – development environment)

    Code snippet:

    const requestRegistrationChallenge = async (phone: string, userId: string) => {
    console.log('inside: requestRegistrationChallenge');
    const response = await fetchWithTimeout(get_registration_challenge_url, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ phone: phone, user_id: userId }),
    });
    return await response.json();
    };



    Server response:

    {
    "challenge": base64url_encode(os.urandom(32)),
    "rp": {
    "name": "TimeClock",
    "id": "192.168.239.144.nip.io"
    },
    "user": {
    "id": base64url_encode(hashlib.sha256(user_id.encode()).digest()[:16]),
    "name": "0501234567",
    "displayName": "0501234567"
    },
    "pubKeyCredParams": [
    {
    "type": "public-key",
    "alg": -7
    },
    {
    "type": "public-key",
    "alg": -257
    }
    ],
    "authenticatorSelection": {
    "userVerification": "preferred"
    },
    "timeout": 60000,
    "attestation": "direct"
    }



    Then on Android:

    const result = await Passkey.create(attestationOptions);


    Catch exception:

    {
    "error": "Native error",
    "message": "Error: The incoming request cannot be validated"
    }

    Continue reading...

Compartilhe esta Página