Summary:
I can't find the Android code to authenticate a Google user with my Cognito User Pool.
Detail:
Here is what I have done so far:
- Created a Cognito User Pool and a User Client in that user pool
- Created a Google Web App in Google Console
- Configured Google as a Federated Identity Provider in my Cognito User Pool (providing Google Client Id and Secret)
- Tried the Hosted UI from the AWS Console and verified that I am able to sign in using my Google credentials, the user gets created in the User Pool.
Okay, next step: Implement the sign in flow in Android. I want to implement both Google sign-in as well as username-password signup/sign-in in my Android app. I am able to successfully implement username/password signup and sign-in flow in my app, here is how:
- I create a
CognitoUserPool
instance using my user pool id and user client id - I used methods
signUpInBackground
andgetSessionInBackground
ofCognitoUserPool
andCognitoUser
respectively.
Now, I want to enable Google sign in. I cannot find any code on how to do this using CognitoUserPool. I found code samples to do this using Cognito Identity Pool. But I haven't created an Identity Pool and since I am able to login using Google on the Hosted UI sample, I am pretty sure I don't need it.
Questions:
- Do I really need an Identity Pool to enable Google sign in on my Android app? Why?
- If not, are there any code samples which show how to enable Google sign in using CognitoUserPools?
Any pointers appreciated.