Skip to content

[Cognito/iOS] JSON Passkey.createPlatformKey is incomplete #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
steson322 opened this issue Jan 24, 2025 · 1 comment
Open

[Cognito/iOS] JSON Passkey.createPlatformKey is incomplete #59

steson322 opened this issue Jan 24, 2025 · 1 comment
Labels

Comments

@steson322
Copy link

steson322 commented Jan 24, 2025

When creating a platform key using the request object from Cognito on iOS (see below), the result response json object is incomplete (see below).

This issue only exists on iOS (tested on 18.2), but not Android. For iOS to work, I need to manually alter the response JSON.

Request JSON

{
    "authenticatorSelection": {
        "requireResidentKey": true,
        "residentKey": "required",
        "userVerification": "preferred"
    },
    "challenge": "...",
    "excludeCredentials": [
        {
            "id": "...-w5olMQ",
            "type": "public-key"
        }
    ],
    "pubKeyCredParams": [
        {
            "alg": -7,
            "type": "public-key"
        },
        {
            "alg": -257,
            "type": "public-key"
        }
    ],
    "rp": {
        "id": "...",
        "name": "..."
    },
    "timeout": 60000,
    "user": {
        "displayName": "...",
        "id": "...",
        "name": "..."
    }
}

Response JSON

{
    "id": "...",
    "rawId": "...",
    "response": {
        "attestationObject": "...",
        "clientDataJSON": "..."
    },
    "type": "public-key"
}

Workaround

The workaround is to add authenticatorAttachment and transports as following, the the registration workflow works on iOS via Cognito.

{
    "authenticatorAttachment": "platform",
    "id": "...",
    "rawId": "...",
    "response": {
        "attestationObject": "...",
        "clientDataJSON": "...",
        "transports": [
            "internal",
            "hybrid"
        ]
    },
    "type": "public-key"
}

Then, during sign-in, I have to erase transports from allowCredentials array in the PasskeyGetRequest for it to retrieve the Passkey & sign-in correctly.

Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant