Credential Manager Throws Error: 'JSON Object doesn't have linked key' When Creating Credential

249 Views Asked by At

I can successfully created a passkey device in Google and created a credential (screen lock) which can be seen in "Password Manager" in "Manage your Google Account" before. And then I did some changes and tests. And I rolled back my code.

I can get the passkey prompt like this enter image description here

However, App cannot show credential selector and got the following error:

Fido                    com.google.android.gms.ui            E  [DigitalAssetsAssociationChecker] JSON Object doesn't have linked key
Fido                    com.google.android.gms.ui            E  [Fido2RequestController] The incoming request cannot be validated
Fido                    com.google.android.gms.ui            E  [Fido2RequestController] The incoming request cannot be validated
Fido                    com.google.android.gms.ui            E  [FidoApiImpl] pauseSecurityKeyRequestController should not be called when SecurityKeyRequestController is null.
TaskPersister           system_server                        E  File error accessing recents directory (directory doesn't exist?).
Fido                    com.google.android.gms.ui            E  [FidoApiImpl] finishSecurityKeyRequestController should not be called when SecurityKeyRequestController is null.
WebAuthn                com.myapp.test                       E  [createCredential] CreateCredentialException: Credential save error
                                                                    androidx.credentials.exceptions.CreateCredentialCustomException: The incoming request cannot be validated
                                                                    at androidx.credentials.exceptions.publickeycredential.CreatePublicKeyCredentialDomException$Companion.createFrom(CreatePublicKeyCredentialDomException.kt:56)
                                                                    at androidx.credentials.exceptions.publickeycredential.CreatePublicKeyCredentialException$Companion.createFrom(CreatePublicKeyCredentialException.kt:51)
                                                                    at androidx.credentials.CredentialProviderFrameworkImpl.convertToJetpackCreateException$credentials_release(CredentialProviderFrameworkImpl.kt:315)
                                                                    at androidx.credentials.CredentialProviderFrameworkImpl$onCreateCredential$outcome$1.onError(CredentialProviderFrameworkImpl.kt:201)
                                                                    at androidx.credentials.CredentialProviderFrameworkImpl$onCreateCredential$outcome$1.onError(CredentialProviderFrameworkImpl.kt:187)
                                                                    at android.credentials.CredentialManager$CreateCredentialTransport.lambda$onError$2(CredentialManager.java:752)
                                                                    at android.credentials.CredentialManager$CreateCredentialTransport.$r8$lambda$8NwBIrbcK6SvF9Mra_qL_8hhFMU(Unknown Source:0)
                                                                    at android.credentials.CredentialManager$CreateCredentialTransport$$ExternalSyntheticLambda0.run(Unknown Source:6)
                                                                    at androidx.credentials.CredentialManager$$ExternalSyntheticLambda0.execute(Unknown Source:0)
                                                                    at android.credentials.CredentialManager$CreateCredentialTransport.onError(CredentialManager.java:751)
                                                                    at android.credentials.ICreateCredentialCallback$Stub.onTransact(ICreateCredentialCallback.java:123)
                                                                    at android.os.Binder.execTransactInternal(Binder.java:1344)
                                                                    at android.os.Binder.execTransact(Binder.java:1275)
TaskPersister           system_server                        E  File error accessing recents directory (directory doesn't exist?).

And this is my assetlinks.json:

[
    {
        "relation": [
            "delegate_permission/common.handle_all_urls",
            "delegate_permission/common.get_login_creds"
        ],
        "target": {
            "namespace": "web",
            "site": "https://myapp.test.com"
        }
    },
    {
        "relation": [
            "delegate_permission/common.handle_all_urls",
            "delegate_permission/common.get_login_creds"
        ],
        "target": {
            "namespace": "android_app",
            "package_name": "com.myapp.test",
            "sha256_cert_fingerprints": [
                "62:8D:D4:12:94..."
            ]
        }
    }
]

Well, I know that JSON Object doesn't have linked key usually means that I didn't setup assetlinks.json well on my site. And I also read the answer of the question Android FIDO2 throwing vague errors

However, I can reach my assetlinks.json content throw the link https://myapp.test.com/.well-known/assetlinks.json (This link is fake, not actual one), and I can open my app through app links. And, I can successfully created a passkey device in Google before. But now CredentialManager.create(context).createCredential(context, request) does not work any more

0

There are 0 best solutions below