So i'm planning to integrate google/facebook login and hope the user's data is sync to the user pool in cognito i have. i can achieved this using on website by calling https://domain-name.auth.ap-southeast-1.amazoncognito.com/oauth2/authorize?redirect_uri=&response_type=token&client_id=&scope=phone%20email%20profile%20openid%20aws.cognito.signin.user.admin&identity_provider=Google
after calling this, user will be redirected to google login page and after user do the google login, the user is created to the cognito user pool.
but now for my android client, i'm confused on how to sync the data since it is not a good idea to redirect a mobile apps to that website and perform google login there, so I'm using a google login sdk to generate the id token of my google login. but by the time i get the id token, the user is not sync up to the cognito user pool. so what is the correct way to do it in android? thanks
It is not possible to use this sdk directly with facebook/google, it is only supported through the hosted ui flows. Is having redirects a non-starter for you or is it possible to use the CognitoAuth SDK which handles this for you? https://github.com/aws/aws-sdk-android/tree/master/aws-android-sdk-cognitoauth also see for a demo: https://github.com/awslabs/aws-sdk-android-samples/tree/master/AmazonCognitoAuthDemo
@behrooziAWS i tried to use the cognito auth sample, it will open a webview actually. what i'm trying to achieve is generate the id token in android (which is done), then send it to my middleware(nodejs) to authenticate the token and then push it to cognito user pool. i don't want the android app to open a webview at all.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If you don't need the user to have a userpool account, then use cognito federated identities.
If you are allowing the user to have a userpool account, but don't need the web ui, then you may use the aws-android-sdk-cognitoidentityprovider (userpool) library.
Please re-open or create another issue for other issues.
Thanks
If you are allowing the user to have a userpool account, but don't need the web ui, then you may use the aws-android-sdk-cognitoidentityprovider (userpool) library.
I do not understand how this solves the issue. The identity pool SDK does not include a path to having a user pool user created as a result of social sign in. The only way I am aware of to have this happen at the moment is via the use of the web-based hosted UI, which is less than ideal because it precludes using native SDKs for Facebook, Google, etc, to obtain access tokens, and it does not result in a identity pool CognitoUser
@minbi I think this issue should be re-opened.
Hi @nbonatsakis ,
The identity pool SDK is the Cognito Identity SDK. (included as a dependency in all SDKs as of 2.6.x)
The user pool SDK is the Cognito Identity Provider SDK. (separate aws-android-sdk-cognitoidentityprovider library)
These are two different concepts maintained by Cognito service.
Update: Here is the signUp method. link
Most helpful comment
I do not understand how this solves the issue. The identity pool SDK does not include a path to having a user pool user created as a result of social sign in. The only way I am aware of to have this happen at the moment is via the use of the web-based hosted UI, which is less than ideal because it precludes using native SDKs for Facebook, Google, etc, to obtain access tokens, and it does not result in a identity pool
CognitoUser@minbi I think this issue should be re-opened.