0
votes

I have an AWS Cognito User Pool that I am trying to add Facebook login to on an Android application. My application currently signs in with facebook successfully but does not create a user in my user pool. I have followed the instructions here

https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-social-idp.html#cognito-user-pools-social-idp-step-1

and the test url creates a user (https://my_pool/login?response_type=code&client_id=my_id&redirect_uri=app://). Inside my app I get a successful response from Facebook and have configured my Facebook Developer App with the settings in the url. Can anyone help as to why there is no user created?

LoginManager.getInstance().registerCallback(mFacebookCallbackManager,
            new FacebookCallback<LoginResult>() {
                @Override
                public void onSuccess(LoginResult loginResult) {
                    // App code
                   Log.d(TAG, "Success");
                   --> This is called.
                }

                @Override
                public void onCancel() {
                    // App code
                    Log.d(TAG, "onCancel");
                }

                @Override
                public void onError(FacebookException exception) {
                    // App code
                    Log.d(TAG, "onError");
                }
            });
1
What code are you using to create a user in the Cognito User Pool? - donkon

1 Answers

0
votes

A new Amazon Cognito user is not created automatically when a Facebook user performs a login. To create a Cognito account, you need to use Cognito's hosted UI. There is a library distributed through Gradle available as implementation 'com.amazonaws:aws-android-sdk-cognitoauth:2.9.1 (or whatever number is latest).

A sample can be found at https://github.com/awslabs/aws-sdk-android-samples/tree/master/AmazonCognitoAuthDemo