- Newest
- Most votes
- Most comments
Unfortunately, there is no reliable built-in way to detect a social login from within the Cognito Managed Login flow that would allow you to differentiate between social and Cognito user signups.
The Cognito Managed Login UI is designed to provide a standardized authentication experience with limited customization options. It handles the authentication process internally and doesn't expose detailed information about the specific login method used during the flow.
Both social logins and Cognito username/password signups typically result in similar outcomes from the perspective of the application - a successful authentication with a code returned. The URL parameters and Hub events you mentioned are indeed not reliable indicators for distinguishing between these login types.
If differentiating between social and Cognito signups is crucial for your application, you might need to consider alternative approaches:
-
Custom UI: Implement your own authentication UI instead of using the Managed Login. This would give you more control over the process and allow you to track the login method explicitly.
-
Post-authentication check: After a successful login, you could make an additional API call to retrieve user attributes. Social logins often have different attribute patterns compared to Cognito native users, which might help you infer the login type.
-
Pre-authentication redirection: Instead of relying on the Managed Login UI, you could implement a custom landing page where users choose their login method explicitly. This choice could then be passed to your application before redirecting to the appropriate authentication flow.
-
Identity Provider parameter: If you're initiating the login process programmatically, you can use the 'identity_provider' parameter in the authorization URL to specify a particular social provider. This bypasses the Managed Login UI and goes directly to the social provider's login page.
Keep in mind that these workarounds have their own limitations and may require significant changes to your authentication flow. If this functionality is critical for your application, you might need to reconsider your authentication strategy or reach out to AWS support for potential solutions or upcoming features that might address this need.
Sources
SignUp version of Cognito/Amplify Managed Login UI | AWS re:Post
Displaying error message in Cognito managed login sign-in page | AWS re:Post
Using social identity providers with a user pool - Amazon Cognito
answered 2 years ago
Relevant content
asked 3 years ago
asked 3 years ago
