amplify-js icon indicating copy to clipboard operation
amplify-js copied to clipboard

fix(singleton): allow oauth listener to be called with the latest config

Open israx opened this issue 7 months ago • 0 comments

Description of changes

Amplify.configure will call oAuthListener and it will pass the Auth config. This oAuthListener is responsable for completing an OAuth flow. However when Amplify.configure is called more than 1 time, the oAuthListener will be called only with the first Auth config.

This fix makes sure the oAuthListener is called only and only if a valid OAuth config and oAuthListener are already defined. And ensures the oAuthListener is called with the latest config of Amplify.

  • Before Amplify.configure with config1 -> Amplify.configure with config2 -> call oAuthListener with config1

  • After Amplify.configure with config1 -> Amplify.configure with config2 -> call oAuthListener with config2

Issue #, if available

https://github.com/aws-amplify/amplify-js/issues/12849

Description of how you validated changes

  • smoke testing
  • unit tests

Checklist

  • [ ] PR description included
  • [ ] yarn test passes
  • [ ] Unit Tests are changed or added
  • [ ] Relevant documentation is changed or added (and PR referenced)

Checklist for repo maintainers

  • [ ] Verify E2E tests for existing workflows are working as expected or add E2E tests for newly added workflows
  • [ ] New source file paths included in this PR have been added to CODEOWNERS, if appropriate

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

israx avatar Jul 24 '24 20:07 israx