简体   繁体   中英

AWS Cognito User Pool with Facebook

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");
                }
            });

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM