aws-amplify / aws-amplify/amplify-cli

amplify env checkout doesn't prompt for OAuth social provider credentials when the env was previously pushed with default auth configuration

Open
#7,934 1 comment 0 reactions 0 assignees View on GitHub
auth bug multienv p2
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

### Before opening, please confirm:

- [X] I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-cli/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting bug reports](https://github.com/aws-amplify/amplify-cli/blob/master/CONTRIBUTING.md#bug-reports).
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

### How did you install the Amplify CLI?

npm

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

14.x

### Amplify CLI Version

5.3.0

### What operating system are you using?

Mac

### Amplify Categories

auth

### Amplify Commands

env

### Describe the bug

Assume there are 2 amplify environments 'dev' and 'test', both configured with default auth configuration. Now update auth to include social provider in env 'dev' and do amplify push. Execute 'amplify env checkout test', this step doesn't prompt for social provider credentials, thus all the subsequence amplify push fails.

![image](https://user-images.githubusercontent.com/83315412/129096020-ecebaccb-f561-4ee8-b16f-91ab352d2eb3.png)

### Expected behavior

Expect CLI to prompt for OAuth credentials while checking out the second environment (similar to `amplify env add`).

### Reproduction steps

1. Have two environments in Amplify with auth without any 3rd Party authentication providers for user pool set up.
2. Update Auth to include 3rd party Auth eg. Facebook in env 1 and perform amplify push.
3. Perform “amplify env checkout env2” and then perform amplify push. This should reproduce the same error as on checkout amplify cli does not ask to input Client ID and Client secret for the 3rd Party Authentication. ( This happens when creating a fresh environment ) .
4. Additionally performing amplify checkout to the previous environment causes the previous environment to fail on amplify push as well. Reason here looks like Amplify is not keeping track of app ID and secrets for third party auth.

### GraphQL schema(s)

```graphql
# Put schemas below this line

```

### Log output

```
# Put your logs below this line

```

### Additional information

Workaround:
Perform “amplify update auth” > “Update OAuth social providers” and enter Facebook/Google AppId and secret. Then run “amplify push” and this should fix the issue.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.