AWS Cognito Sign-In (Android)

后端 未结 3 1742
一整个雨季
一整个雨季 2021-01-06 19:25

I am trying to figure out how to sign in a User with AWS Cognito. The tutorials all seem to deal with Users from a standpoint of signing up Users, not signing them in. I do

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-06 19:51

    Cognito User Pools seem to be what you want in your app. What Cognito User Pools does is it gives you a user directory that stores user attribute data and can be used to authenticate against with username and password by your mobile app/website.

    Cognito Federated Identities lets you federate users from Facebook, Google, even Cognito User Pools above for the purpose of obtaining AWS credentials to access AWS resources.

    From your use case, it seems that you want to create and confirm the users from the admin side, a functionality that Cognito provides by using the adminCreateUser API. After that, the users can sign in by using username and password by using the example 6 in the tutorial you linked.

    You can create an empty CognitoUser by calling getUser() on an initialized UserPool.

    Code:

        user = userPool.getUser();
        AuthenticationDetails authenticationDetails = new AuthenticationDetails(email, password, null);
        user.authenticateUserInBackground(authenticationDetails, authenticationHandler);
    

提交回复
热议问题