Skip to content
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

Creating Amplify auth social sign-in throws error on hosted UI providers #792

Open
4 tasks done
ykethan opened this issue Jan 12, 2023 · 7 comments
Open
4 tasks done
Labels
auth An issue identified as a authentication bug/feature bug An issue which has been identified as a bug studio-ui An issue that needs to be tracked by Studio Console team

Comments

@ykethan
Copy link
Member

ykethan commented Jan 12, 2023

Before opening, please confirm:

App Id

d1qbjxyhsg82r

Region

us-east-1

Environment name

staging

Figma File Version (if applicable)

No response

Amplify CLI Version

10.5.2

If applicable, what version of Node.js are you using?

No response

What operating system are you using?

Mac

Browser type?

chrome

Describe the bug

Adding authentication with social sign-in as Apple causes the push to fail.
Passing in private key with -----BEGIN PRIVATE KEY-----, -----END PRIVATE KEY----- causes the hosted provider function to fail. The Amplify CLI only accepts the key without the comments.

The cloudwatch logs for callout function throws the following error

{
    "Status": "FAILED",
    "Reason": "See the details in CloudWatch Log Stream: ******",
    "PhysicalResourceId": "2022/12/02/[$LATEST]*****",
    "StackId": "****",
    "RequestId": "7550d102-29fc-4377-b31d-d5759f845fbd",
    "LogicalResourceId": "HostedUIProvidersCustomResourceInputs",
    "NoEcho": false,
    "Data": {
        "err": {
            "message": "Internal server error.",
            "code": "InternalErrorException",
            "time": "2022-12-02T10:12:13.234Z",
            "requestId": "dbc******",
            "statusCode": 500,
            "retryable": true
        }
    }
}

refer to aws-amplify/amplify-cli#11526 (comment) and aws-amplify/amplify-cli#11526 (comment) for additional information.

Expected behavior

Validate key the key or parse the key with correct information.

Reproduction steps

  1. select authentication
  2. remove email and add phone number as login mechanism
  3. add social signin with apple
  4. add credentials (i pasted the key in with the -----BEGIN PRIVATE KEY-----) and deploy

Project Identifier

No response

Additional information

No response

@ykethan ykethan added pending-triage An issue that is pending triage auth An issue identified as a authentication bug/feature bug An issue which has been identified as a bug and removed pending-triage An issue that is pending triage labels Jan 12, 2023
@johnpc
Copy link

johnpc commented Jan 12, 2023

It looks like Amplify CLI might have logic to extract the correct value:
https://github.com/aws-amplify/amplify-cli/blob/dev/packages/amplify-category-notifications/src/apns-cert-p12decoder.ts#L77-L90

@petercwk
Copy link

petercwk commented Jan 19, 2023

This seems to another possible code snippet that extracts the private key for the auth category.
https://github.com/aws-amplify/amplify-cli/blob/dev/packages/amplify-category-auth/src/provider-utils/awscloudformation/utils/extract-apple-private-key.ts

Not clear if it is working or if it is actually used in headless mode

@ykethan ykethan added the studio-backend An issue that needs to be tracked by Studio Backend team label Jan 20, 2023
@petercwk
Copy link

petercwk commented Jan 25, 2023

Root cause could be that Step 2 of the authentication workflow should be required, but customers are able to deploy without selecting one.

Selecting Email resulted in a successful deployment on my last test.

Screen Shot 2023-01-25 at 11 08 32 AM

@ykethan
Copy link
Member Author

ykethan commented Jan 25, 2023

Hey @petercwk, it failed in headless when i tested this: aws-amplify/amplify-cli#11526 (comment)

@petercwk
Copy link

Hey @petercwk, it failed in headless when i tested this: aws-amplify/amplify-cli#11526 (comment)

From the json payload, "requiredSignupAttributes": []. Could you try adding "PHONE_NUMBER"

@ykethan
Copy link
Member Author

ykethan commented Jan 26, 2023

using that also fails. On deeper dive found that using Phone number may not be supported by apple sign in. Headless fails for the same reason but when changing to email this works. Need to check if Cognito actually supports Apple sign-in with phone number.

@ykethan
Copy link
Member Author

ykethan commented Jun 4, 2024

Note: the improvement here is to add validation on the box to see if this is a valid key. The fix will need to be on the CLI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth An issue identified as a authentication bug/feature bug An issue which has been identified as a bug studio-ui An issue that needs to be tracked by Studio Console team
Projects
None yet
Development

No branches or pull requests

4 participants