मैं नया कॉग्निटो हूं। मैं Lambda का उपयोग कर AWS Cognito लागू करने की कोशिश कर रहा हूँ। यह tutorial है जिसका मैं अनुसरण कर रहा हूं।एडब्ल्यूएस कॉग्निटो त्रुटि: 'identityPoolId' बाधा को संतुष्ट करने में विफल रहा
AmazonCognitoIdentityClient client =
new AmazonCognitoIdentityClient();
GetOpenIdTokenForDeveloperIdentityRequest tokenRequest = new GetOpenIdTokenForDeveloperIdentityRequest();
tokenRequest.setIdentityPoolId("us-east-1_XXXXXXX");
इस पूल पहचान है कि मैं setIdentityPoolId में उपयोग कर रहा हूँ है
यह JUnit परीक्षण
public class AuthenticateUser implements RequestHandler<Object, Object> {
@Override
public Object handleRequest(Object input, Context context) {
AuthenticateUserResponse authenticateUserResponse = new AuthenticateUserResponse();
@SuppressWarnings("unchecked")
LinkedHashMap inputHashMap = (LinkedHashMap)input;
User user = authenticateUser(inputHashMap);
return null;
}
public User authenticateUser(LinkedHashMap input){
User user = null;
String userName = (String) input.get("userName");
String passwordHash = (String) input.get("passwordHash");
try {
AmazonDynamoDBClient client = new AmazonDynamoDBClient();
client.setRegion(Region.getRegion(Regions.US_EAST_1));
DynamoDBMapper mapper = new DynamoDBMapper(client);
user = mapper.load(User.class, userName);
if(user != null){
System.out.println("user found");
if(user.getPasswordHash().equals(passwordHash)){
System.out.println("user password matched");
String openIdToken = getOpenIdToken(user.getUserId());
user.setOpenIdToken(openIdToken);
return user;
} else {
System.out.println("password unmatched");
}
} else {
System.out.println("user not found");
}
} catch (Exception e) {
System.out.println("Error: " + e.toString());
}
return user;
}
यह आउटपुट
user found
user password matched
है
लेकिन मैं निम्नलिखित त्रुटि हो रही है और इसलिए, return user
बयान
1 validation error detected: Value 'us-east-1_XXXXXX' at 'identityPoolId'
failed to satisfy constraint: Member must satisfy regular expression pattern: [\w-]+:[0-9a-f-]+
(Service: AmazonCognitoIdentity; Status Code: 400; Error Code: ValidationException;
मुझे 2 घंटे बचाया !!! –
@ चेतन- मुझे लगता है कि आपको ट्यूटोरियल को बेहतर बनाने और पहचान पूल – suku
@Chetan के लिए संघीय पहचान प्रबंधित करने "से बेहतर नाम बनाने के लिए प्रतिक्रिया के रूप में इस जवाब पर उपरोक्त का उपयोग करना चाहिए। आप उपयोगकर्ता पूल आईडी से पहचान पूल आईडी कैसे प्राप्त करेंगे? या वर्तमान भूमिका जो कॉग्निटो उपयोगकर्ता से जुड़ी है? –