如何在Cognito中检查现有用户-Android?
问题描述:
所以我在Android中设置了aws cognito.而且我想执行检查以查看用户何时输入用户名,该用户名在我的认知池中尚不存在.
so i have aws cognito set up in android. And i want to perform a check to see when the user enters a username, that that username doesn't already exist in my cognito pool.
目前我有这个:
cognitoUser = userPool.getUser(username_ET.getText().toString());
if(cognitoUser.getUserId().isEmpty())
{
//Great, this is a new user.
}
但是,cognitoUser只是设置为我输入的内容,它不会返回检查.
But, cognitoUser just gets set to whatever i put in, it doesn't go back in check.
希望有人可以提供帮助!
Hope someone can help!
答
如果尝试使用不存在的用户名登录,则会收到UserNotFoundException异常.
If you try signing in with a username that doesn't exist, you will get a UserNotFoundException exception.