aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.83k stars 823 forks source link

Can't update credentials for Sign In With Apple and Hosted UI doesn't render properly #10152

Open chrisbonifacio opened 2 years ago

chrisbonifacio commented 2 years ago

Before opening, please confirm:

How did you install the Amplify CLI?

npm

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

16.13.0

Amplify CLI Version

7.6.26

What operating system are you using?

Mac (M1)

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No manual changes made

Amplify Categories

auth, api

Amplify Commands

update

Describe the bug

When I try to update the credentials for my Apple OAuth Provider, the changes are not detected when checking resource status or attempting to push.

Another strange thing I observed is that after creation of the auth resource with my apple oauth provider configured, the Hosted UI doesn't render.

Links and Scripts in the Header contain null in parts of the CDN urls

Hosted UI Endpoint : https://remixamplified169d1d34-169d1d34-dev.auth.us-east-1.amazoncognito.com/

Screen Shot 2022-04-07 at 1 27 28 PM

Test Your Hosted UI Endpoint : https://remixamplified169d1d34-169d1d34-dev.auth.us-east-1.amazoncognito.com/login?response_type=code&client_id=j72tq46t3ecn7ru5hh2osi9gm&redirect_uri=http://localhost:3000/

Screen Shot 2022-04-07 at 1 27 28 PM

Expected behavior

Changes to hostedUIProviderCreds should be detected on amplify push and/or amplify status

Hosted UI Endpoint should load styles and scripts and render the login form properly

Reproduction steps

  1. amplify init
  2. amplify add auth
  3. 
    Warning: you will not be able to edit these selections.
    
    How do you want users to be able to sign in? Email
    
    Do you want to configure advanced settings? No, I am done.
    
    What domain name prefix do you want to use? remixamplified169d1d34-169d1d34
    
    Enter your redirect signin URI: http://localhost:3000/

? Do you want to add another redirect signin URI No

Enter your redirect signout URI: http://localhost:3000/

? Do you want to add another redirect signout URI No

Select the social providers you want to configure for your user pool: Sign in with Apple

... input Sign In With Apple credentials (Service ID, Team ID, Private Key, etc)

 4. `amplify push -y`

 5. `amplify update auth`

 6. "Update OAuth social providers"

 7. update any credentials

 8. `amplify push -y`

 9. "No changes detected"

### GraphQL schema(s)

<details>

```graphql
# Put schemas below this line

Log output

``` # Put your logs below this line ```

Additional information

No response

ykethan commented 2 years ago

Hi @chrisbonifacio, Thank you for reporting this. I was able to replicate the behaviour in my Amplify application. In addition to the steps provided I observed the following in my replication.

  1. After adding the Cognito auth with the Apple credentials.
  2. Perform amplify push.
  3. Perform amplify update auth.
  4. I entered random strings for credentials. The CLI recognized the update on the auth resource.

image

  1. I ran amplify update auth to correct my credentials. The CLI recognized the update on the auth resource.

image

  1. amplify push
  2. run amplify update auth
  3. enter different credentials or random credentials.

Observed that CLI did not recognize the updated credentials this time. image

ykethan commented 2 years ago

Marking this as bug.

chrisbonifacio commented 2 years ago

Hey @ykethan, thanks for updating the issue. Just wanted to point out that this behavior (changes not being detected) is known to the CLI team, it's just not a great developer experience. The workaround is to manually change the hostedUIProviderCreds attribute within the ~/.aws/amplify/deployment-secrets.json file for the corresponding environment.

Besides that, the other issue with the Hosted UI still remains, where it renders properly only on the test url but not the regular one. Did you also see this behavior after pushing your auth resource and trying to access the Hosted UI? I just wasn't sure if it was related to my using a social provider or not. I tried with both Apple and Google, same issue. I can open a separate issue for that if need be.

ykethan commented 2 years ago

Was able to replicate the same errors as mentioned by @chrisbonifacio. Running amplify status and opening the Hosted UI Endpoint throws the same errors.