-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Support completing an OAuth flow that is not initiated by Amplify (signInWithRedirect) #13343
Comments
hello @bbdev9805 . Sorry for any inconvenience using the library. Amplify v6 supports OAuth flows initiated from the same App only. You would need to kick off the OAuth flow by calling the |
@israx |
supporting IdP logins would be a feature request. The Auth singleton in Amplify v5 has a listener that would capture any |
@israx have you got any further with the request to fix/begin supporting IdP logins again in v6? I am relying on this to upgrade from Amplify v5 -> v6. Cheers. |
+1 for support please |
+1 as well. We are depending on this featured to be able to upgrade to version 6 |
+1 Same |
+1 Cant update to v6 without this |
+1 |
FYI, |
Hello everyone. I'll revisit this issue with the team to discuss its prioritization. Thank you for your patience. |
I deleted my comment because I think in retrospect it wasn't related to this specify issue - it seems I had in fact failed to configure my S3 bucket properly for SPA hosting - so apologies for that |
+1 |
Hi @israx , Is there any news on this? I suppose the conclusion was that this is not a priority? |
Any news on this issue? We are blocked from upgrading to version 6 because of this. |
Hey @hakonmuggerud We are currently evaluating this use case while considering maintaining the OAuth 2.0 specs required security posture. Thanks for your patience. |
Hey folks in the thread 👋 in an effort to better understand the use cases for sign-in events initiated from an upstream, OAuth-based identity provider, I have a few questions:
|
I just ran into this as well trying to add IdP-initiated SAML authentication for my amplify v6 app. To answer your questions:
|
Thanks for following up with the answers to @josefaidt's questions, @paulcwatts. Anyone else following this issue, feel free to do the same! While there's no update yet, we are taking note of these use cases to better understand how to support this feature. |
For what it's worth, I have an interesting workaround: if my callback is called with a Basically:
Maybe this will work for others in this situation. |
Hey @paulcwatts are you looking to set up Microsoft Entra ID as a SAML provider or OIDC? If SAML you should be okay directing the request to Cognito, who will then redirect to your app |
@josefaidt I'm setting it up as a SAML provider, using these instructions: https://aws.amazon.com/blogs/security/how-to-set-up-saml-federation-in-amazon-cognito-using-idp-initiated-single-sign-on-request-signing-and-encrypted-assertions/ That's correct, when I configure Entra it goes to Cognito first, then goes to my callback URL (specified in the RelayState). However, the callback is only given a |
Hey @paulcwatts thanks for adding those details! Looking into this a bit further you will need to set up your app portal (or rather the page where you're initiating the upstream sign-in) to direct to your app first. Cognito can not be used as a SAML provider, but following the route of initiating sign-in from your app will allow your end users to connect to the same session as Cognito is orchestrating sign-in:
|
Hey @josefaidt or @paulcwatts. I don't even see this working with SP-initiated flow. Maybe same root cause or different - not clear. Appreciate any help Specs
Source Doc The Problem After calling
^ I do see both code and state (again, SP-initiated flow), but the app using the Authenticator UI component doesn't seem to do anything with it.
Is the Authenticator component fumbling SP-initiated flow here? According to the Source Doc and given that the amplify gen 2 docs point to using the Authenticator component for setting up auth, it seems like this should just otherwise work. When you wrote the documentation @josefaidt what was your setup? The Flow User ...
Code
Other Issues aws-amplify/amplify-ui#6306 |
It seems like this is getting a bit off the rails, so I want to be clear with the facts as I know them:
To answer your question, @josefaidt , as far as I am aware I cannot set Entra's app portal to direct to my app first. The app link that it creates looks like https://launcher.myapps.microsoft.com/api/signin/xxxx?tenantId=yyy, which starts the IdP-initiated SAML flow. In any event, like I said, if I were to redirect to my app first and then use So what I'm really just asking is that Amplify support what Cognito supports -- which is IdP-initiated SAML -- by finishing the flow (calling the OAuth |
As far as I can tell, this is the initial source of the issue: https://github.com/aws-amplify/amplify-js/blob/main/packages/auth/src/providers/cognito/utils/oauth/completeOAuthFlow.ts#L89 Notice how it doesn't complete the flow if there's no The bigger problem is that the rest of the code depends on that |
Hey @bhelabhav thank you for reporting the issue with great details. Reading the issue description, I suspect that the cause is that the OAuth completion listener was not attached and executed within the JS bundle of the callback URL in your app. The OAuth listener is a side effect that resides along with the import 'aws-amplify/auth/enable-oauth-listener'; See this doc for more details. To be noted, your issue is not related to the OP's request, as your OAuth flow is initiated with the |
Got it - thanks for clarifying. Let me fork a new issue from this one. |
I can confirm the |
Before opening, please confirm:
JavaScript Framework
Angular
Amplify APIs
Authentication
Amplify Version
v6
Amplify Categories
auth
Backend
Amplify CLI
Environment information
Describe the bug
SSO via SAML works for SP-initiated but not for IdP-initiated SSO after upgrading to v6 from v5. I am redirected from the Idp to [https://www.example.com/?code=Authorization code] but cannot obtain the authentication token. When the getCurrentUser API is executed, a UserUnAuthenticatedException error occurs. IdP-initiated SSO also works in V5. This needs to be resolved immediately if IdP-initiated SSO is to be supported. https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-SAML-session-initiation-idp-initiation.html
Expected behavior
As in V5, the token can be obtained correctly after redirecting from the Idp.
Reproduction steps
getCurrentUser()
.Code Snippet
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: