Suppose
Suppose

Reputation: 52

Android 10 can not create passkey (react native app)

I'm facing issue with react-native-passkey lib

on document said "Native Passkeys on iOS 15.0+ and Android API 28+ using React Native."

I'm building .apk file which config passkey as document.

  async function createAccount() {

    //generate a challenge from backend
    try {
      const requestJson = {
        'challenge': 'T1xCsnxM2DNL2KdK5CLa6fMhD7OBqho6syzInk_n-Uo',
        'rp': {
          'name': 'Passkey',
          'id': 'com.myapp',
        },
        'user': {
          'id': 'user123',
          'name': '[email protected]',
          'displayName': 'john Does',
        },
        'pubKeyCredParams': [
          {
            'type': 'public-key',
            'alg': -7,
          },
        ],
        'authenticatorSelection': {
          'authenticatorAttachment': 'platform',
          'requireResidentKey': true,
          'userVerification': 'preferred',
        },
        'timeout': 60000,
        'attestation': 'direct',
      };


      const result = await Passkey.create(requestJson);

      console.log('Registration result: ', result);
    } catch (e) {
      console.log('Registration result:',e);
   
    }
  }

I was testing on 3 devices. 1st is android 14, it can create passkey as expected. but my 2nd and 3rd device are android 10. I'm unable to create passkey and got error as {"error": "Native error", "message": "Error: The incoming request cannot be validated"}

Do you know how to fix?

Upvotes: 0

Views: 63

Answers (1)

Suppose
Suppose

Reputation: 52

So I just change rp.id on requestJson to my domain from https://mydomain/.well-known/assetlinks.json

like

 'rp': {
      'name': 'Passkey',
      'id': 'mydomain',
    },

Upvotes: 0

Related Questions