question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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/<my-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

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
tfmorriscommented, Jan 18, 2021

This is a huge pain for us as well. Why was it closed?

I think the stale bot needs different parameters when it’s closing things after just a month, but the development team can take many months to reply or make progress on issues.

0reactions
adamjamesturner93commented, Jun 27, 2021

Is there any idea or eta on when this might be added to the core functionality?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Callbacks | NextAuth.js
This callback is called whenever a JSON Web Token is created (i.e. at sign in) or updated (i.e whenever a session is accessed...
Read more >
Use existing Cognito resources for your Amplify API, Storage ...
In this guide you will learn how to integrate your existing Cognito User Pool & Federated Identities (Identity Pool) into an Amplify project....
Read more >
AuthClass | amplify-js
Parameters · user: CognitoUser | any. The CognitoUser object · oldPassword: string. the current password · newPassword: string. the requested new password ·...
Read more >
AWS Auth parameters are overwritten in multiple env
a solution that worked for our team is to create a script overwriting the parameters.json when we want to build it in our...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found