-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Added support for idp_identifier query parameter in cognito authorize… #10505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ncarvajalc
wants to merge
1
commit into
aws-amplify:main
Choose a base branch
from
ncarvajalc:feat/auth-added-idp-identifier-option
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Added support for idp_identifier query parameter in cognito authorize… #10505
ncarvajalc
wants to merge
1
commit into
aws-amplify:main
from
ncarvajalc:feat/auth-added-idp-identifier-option
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I have submitted #14423 as an alternative PR to this one, as the auth library has changed significantly since this was authored. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
… endpoint
Description of changes
Files changed
The following files had changes:
packages/auth/src/types/OAuth.ts
packages/auth/src/Auth.ts
packages/auth/src/OAuth/OAuth.ts
Changes
The
packages/auth/src/types/OAuth.ts
file had the following changes:An
idpIdentifier
filed was added as an optional field in theFederatedSignInOptions
andFederatedSignInOptionsCustom
types to enable the idp_identifier query parameter when sending the request URL to the Cognito authorize endpoint. Additionally, ahasIdpIdentifier
function was added to evaluate if the provider options have anidpIdentifier
key. Also, the provider field was made optional, as either anidp_identifier
or aprovider
is used when requesting for an IdP, as described in the Amazon Cognito documentation.The
packages/auth/src/Auth.ts
file had the following changes:The
hasIdpIdentifier
function was used to check for theidpIdentifier
key. In case it has it, the idpIdentifier value is extracted either from theFederatedSignInOptions
type or theFederatedSignInOptions
type. After that theidpIdentifier
is passed to thethis._oAuthHandler.oauthSignIn
function.Finally, the
packages/auth/src/OAuth/OAuth.ts
file had the following changes:The function
oauthSignIn
was modified to make theprovider
argument optional and added an optional argumentidpIdentifier
. In case there is aprovider
present the request URL generated will send theprovider
as theidentity_provider
query parameter and ignore anyidpIdentifier
present, as either anidp_identifier
or anidentity_provider
is used when requesting for an IdP. In case there is no provider, it will check for the idpIdentifier and send it as theidp_identifier
query parameter in the Cognito authorize endpoint.Issue #, if available
Closes #10226
Description of how you validated changes
I created a sample React app with the following component:
The federate sign in identity was set up as described in the comment in #10226 and adding an IdPidentifier as shown below:

The app successfully logged in the user and added it to the cognito user pool created.
Previous test cases when using default options or no arguments for the
federatedSignin
function where tested and they worked correctly.Checklist
yarn test
passes (It is not working for @aws-amplify/storage tests in the latest branch)yarn run test --scope @aws-amplify/auth
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.