aws-amplify / aws-amplify/amplify-cli

Stop storing CallbacksUrl & LogoutURLs settings in oAuthMetadata in auth parameters.json

Open
#5,401 8 comments 4 reactions 0 assignees View on GitHub
auth feature-request p3
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

**Is your feature request related to a problem? Please describe.**

We have an Amplify project that uses Cognito and Auth.federatedSignIn.
We have multiple environments: prod, preprod, dev, QA, ...
For all of our environments the CallbacksUrl are differents, they look like:

* example.com
* preprod.example.com
* dev1.example.com

Today values of the CallbacksUrl and LogoutURLs are defined in _amplify/backend/auth//parameters.json_ so this value is shared among environment.
Because of that we need to override values manually in Cognito in the AWS console with the risk of having the value erased again if the auth is deployed again.
This makes a multi-env and/or team work on our Amplify project very painful.

An associated problem is that those CallbacksUrl and LogoutURLs values are injected in _aws-exports.js_ in oauth section:

```
"oauth": {
...
"redirectSignIn": "https://example.com",
"redirectSignOut": "https://example.com/logout",
...
},
```
We also have to override that at compile time in a npm script with Regex to force Auth class or Amplify-js framework to use our custom values. This is an extra pain point.

**Describe the solution you'd like**

I like you to store the CallbacksUrl and LogoutURLs setting in _team-provider-info.json_. This way all env have a specific value.
Then when the developer change the values in team-provider-info.json, detect that the auth needs to be updated. This specific need is explained here #5403 in a more general context.

These CallbacksUrl and LogoutURLs values will be injected in aws-export.js accordingly to the current checked out env.

The other settings (AllowedOAuthFlows, AllowedOAuthScopes) can be kept the same we share the same value in all our env.

Bonus:
When we update the value in an env in team-provider-info.json that will be great if you can push the change.

**Describe alternatives you've considered**

We created a custom resource with a Lambda that override the value playing with Cognito APIs (not within CloudFormation). This is a pain to write that and maintain it.

**Additional context**

Our project is opensource (and can be deployed by other people in their own env) which make the hardcoding of CallbacksUrl an extra pain.

This ticket will be easier to solve with #5403 done

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.