Skip to content
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

Google login is success, but users are not saved into User Pools #685

Open
anggrayudi opened this issue Feb 3, 2019 · 5 comments
Open
Labels
feature-request Request a new feature mobile client Issues with AWS Mobile's client-side Cognito wrapper service The issue does NOT exist in the Android SDK, but rather in the AWS backend.

Comments

@anggrayudi
Copy link

anggrayudi commented Feb 3, 2019

Describe the bug
When sign in or login using Cognito's User Pools, there's no problem. Here's the screenshot. Users are registered correctly.

Email login

When I use Google Identity Provider, I open Google login group. But no users on it, even though the login is success.

screenshot 13

This is my code:

try {
    val task = GoogleSignIn.getSignedInAccountFromIntent(data)
    val account = task.getResult(ApiException::class.java)!!
    AWSMobileClient.getInstance().federatedSignIn(IdentityProvider.GOOGLE.toString(), account.idToken, object : Callback<UserStateDetails> {
        override fun onResult(details: UserStateDetails) {
             // success, but no user saved to AWS server.
        }

        override fun onError(e: Exception) {
            Log.e(TAG, "sign-in error", e)
        }
    })
} catch (e: ApiException) {
    Log.w(TAG, "signInResult:failed code=" + e.statusCode)
}

I also read my awsconfiguration.json carefully, and I did nothing wrong. I have set Google web app ID, Android Client ID, and App secret as well.

So, where did all users signed in with Google go?

Environment

  • SDK version 2.11.0
@sunchunqiang sunchunqiang added the mobile client Issues with AWS Mobile's client-side Cognito wrapper label Feb 4, 2019
@anggrayudi
Copy link
Author

@sunchunqiang Try to use empty or random string as the JWT token, and AWSMobileClient.getInstance().federatedSignIn() will accept it as valid login token. Then onResult() will be called and showing success state. I have browsed federatedSignIn() source code, and found that this method only save login information into SharedPreferences, instead of saving it to the cloud.

Using federatedSignIn() should handle sign in flow easily. If we need to combine it with API Gateway, Lambda, IAM, etc in order to make a simple login flow, then it will make login feature harder to learn. federatedSignIn() should be used to sign up if users do not have any account yet, and it handle sign in method as well. When users choose Google login, they don't need to sign up again when they want to change login method to default user pools through username and password. All users information must be updated into Cognito User Pools too.

We have to minimize learning curve when using AWS SDK APIs.

@anggrayudi anggrayudi changed the title Google login is success, but users does not saved into User Pools Google login is success, but users are not saved into User Pools Feb 4, 2019
@minbi
Copy link
Contributor

minbi commented Feb 4, 2019

Hi @anggrayudi ,

The federatedSignIn() method only supports federation into Cognito Identity Pool which is why you saw the code store it locally (the actual federation code reads it from the store). Federation into Cognito User Pools is only supported through the HostedUI feature. This is currently achieved using the aws-android-sdk-cognitoauth library which launches a web-based UI. This is currently a service limitation and we are working with the service team to find a resolution.

@minbi minbi added feature-request Request a new feature documentation In code. For issues with public website, move to https://github.com/aws-amplify/docs labels Feb 4, 2019
@Shusshu
Copy link

Shusshu commented Feb 8, 2019

Response migrated to #693

@Shusshu
Copy link

Shusshu commented Feb 8, 2019

Response migrated to #693

@Shusshu
Copy link

Shusshu commented Feb 11, 2019

@anggrayudi #693 might help you as this works for User pool and google login

@minbi minbi added the service The issue does NOT exist in the Android SDK, but rather in the AWS backend. label Apr 11, 2019
@minbi minbi removed their assignment Jun 18, 2019
@sdhuka sdhuka removed the documentation In code. For issues with public website, move to https://github.com/aws-amplify/docs label Feb 10, 2023
@div5yesh div5yesh self-assigned this Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request a new feature mobile client Issues with AWS Mobile's client-side Cognito wrapper service The issue does NOT exist in the Android SDK, but rather in the AWS backend.
Projects
None yet
Development

No branches or pull requests

6 participants