Android 登录时出现AWS Cognito未知错误
当我试图使用android(java)代码在AWS中登录Cognito时,我遇到了一个未知的错误 我已接受IAM中的所有默认角色Android 登录时出现AWS Cognito未知错误,android,amazon-web-services,Android,Amazon Web Services,当我试图使用android(java)代码在AWS中登录Cognito时,我遇到了一个未知的错误 我已接受IAM中的所有默认角色 注册和确认电子邮件工作正常。这正是我想在authenticationContinuation.continueTask()之后登录的时候;显示未知错误。有什么想法吗?建议?原来我用错了poolid duh! 联邦池中也有一个池id,我使用的是它,而不是用户池中的那个 public void SignIn(String phoneNumber) { fina
注册和确认电子邮件工作正常。这正是我想在authenticationContinuation.continueTask()之后登录的时候;显示未知错误。有什么想法吗?建议?原来我用错了poolid duh! 联邦池中也有一个池id,我使用的是它,而不是用户池中的那个
public void SignIn(String phoneNumber) {
final ClientConfiguration clientConfiguration = new ClientConfiguration();
// Create a CognitoUserPool object to refer to your user pool
CognitoUserPool userPool = new CognitoUserPool(_context, poolId, _clientId,
_clientSecret, clientConfiguration);
CognitoUser user = userPool.getUser(phoneNumber);
// Callback handler for the sign-in process
AuthenticationHandler authenticationHandler = new AuthenticationHandler() {
@Override
public void onSuccess(CognitoUserSession cognitoUserSession) {
// Sign-in was successful, cognitoUserSession will contain tokens for the user
Token = cognitoUserSession.getAccessToken();
}
@Override
public void getAuthenticationDetails(AuthenticationContinuation authenticationContinuation, String userId) {
// The API needs user sign-in credentials to continue
AuthenticationDetails authenticationDetails = new AuthenticationDetails(userId, _password, null);
// Pass the user sign-in credentials to the continuation
authenticationContinuation.setAuthenticationDetails(authenticationDetails);
// Allow the sign-in to continue
authenticationContinuation.continueTask();
}
@Override
public void getMFACode(MultiFactorAuthenticationContinuation multiFactorAuthenticationContinuation) {
// Multi-factor authentication is required; get the verification code from user
multiFactorAuthenticationContinuation.setMfaCode("123");
// Allow the sign-in process to continue
multiFactorAuthenticationContinuation.continueTask();
}
@Override
public void onFailure(Exception exception) {
// Sign-in failed, check exception for the cause
Log.d("error:", exception.getMessage());
LoginController loginController = new LoginController(_this);
loginController.NavigateToLogin();
}
};
// Sign in the user
user.getSessionInBackground(authenticationHandler);
}