Closed aniketkambli closed 1 year ago
An updates on this issue?
Any chance to resolve this or any updates? I also have same issue.
i am a iOS dev and facing the same problem.
@bunditta-p @AdiPomelo Catch the error thrown by cognito i.e. Already found an entry for username Google_XXX and then restart the auth flow i.e. call Auth.signIn() again which shows the consent screen again to the user and this time he can login. This only happens the first time and not always, another solution from the UX perspective would be to show the user a message as "Successfully linked/registered the accounts , please login" before showing the oauth consent screen for the second time. Hope this helps !
@bunditta-p @AdiPomelo Catch the error thrown by cognito i.e. Already found an entry for username Google_XXX and then restart the auth flow i.e. call Auth.signIn() again which shows the consent screen again to the user and this time he can login. This only happens the first time and not always, another solution from the UX perspective would be to show the user a message as "Successfully linked/registered the accounts , please login" before showing the oauth consent screen for the second time. Hope this helps !
@aniketkambli Thanks for the solution! I already done catch the error thrown but it not the best way to handle an error. The solution was just workaround while we cannot do anything other than this. The best way is to fix at amplify not to send us Already found an entry for username xxxx
for the first time so we don't have to tricky handle user to login second time.
Hello everyone, thank you for the workarounds that are mentioned on this issue. We are going to investigate this further to minimize the need to do these workarounds in the future!
Login with Slack is also giving the exact same issue and the only workaround is to repeat the OAuth flow which is not good from the UX perspective and in Slack the user has to allow the permission twice
Just noting here in case anyone else finds this issue, this is a known problem from the Cognito side and is on their radar. Currently there is no timeline on when it will be fixed but will update this issue if I hear anything further
Making the user log in twice is not an acceptable work around. Are there any updates on when this will be fixed?
Cognito has recently resolved an issue with linking federated users to an existing user profile in Cognito User Pools. As a result, your Amplify application can now merge user identities from 3rd party social identity providers to a Cognito user in a user pool using the Pre sign-up Lambda trigger. You can use the AdminLinkProviderForUser
API from Cognito to set up custom logic to determine how your user identities get merged. To learn more about the use of this feature, you can check out the following documentation pages.
We will work on resources to share with you to explain how to integrate this feature into your Amplify app.
Following up here, I've tested this and can confirm that the user is not forced to login twice. Please let me know if you are still facing this issue.
@mike247 @aniketkambli @bunditta-p
Thanks!
Related to #5104
Before opening, please confirm:
JavaScript Framework
React
Amplify APIs
Authentication
Amplify Categories
auth
Environment information
Describe the bug
I have a react app with google login integrated in it which has a pre-signup trigger for a lambda which links Cognito user with google user and vice versa i.e. if user had previously signed up with email/password and now the user is trying to login with google then link them using Cognito's AdminLinkUser API and if user is logging in for the first time then create one user and link it with the google account.
When i login with google for the first time it shows the o-auth consent screen and after selecting an email the o-auth flow fails and i get an error as Already found an entry for username Google_XXX.
The only solution is to repeat the auth flow once again wherein the user is shown the consent o-auth screen again and after selecting the email he is successfully logged in and i get back a access token. Successive log-ins works fine on first attempt.
What I want is the user to be logged in the first time itself and not repeat the o-auth flow again, Is there any other workaround for this issue ?
Expected behavior
User is logged in after selecting email on the first consent screen
Reproduction steps
Code Snippet
Amplify configuration in react app:
Amplify.configure({ Auth: { mandatorySignId: true, region: config.cognito.REGION, userPoolId: config.cognito.USER_POOL_ID, userPoolWebClientId: config.cognito.APP_CLIENT_ID, oauth: { domain: 'xxx', scope: ['phone', 'email', 'openid', 'profile', 'aws.cognito.signin.user.admin'], redirectSignIn: 'http://localhost:3000/googleNewRegistration', redirectSignOut: 'http://localhost:3000/login', responseType: 'code', }, }, });
Code to signin the user :
const signIn = async () => { await Auth.federatedSignIn({ provider: CognitoHostedUIIdentityProvider.Google, }); };
Log output
No response
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