我使用cognito Amazon Webservice進行用戶管理。AngularJS上的AWS Cognito登錄錯誤
我已經管理簽約到我了userpool但每次我試圖登錄到我的用戶羣我有這個控制檯錯誤:
Error: this.pool.getUserPoolId is not a function
我不知道哪裏是getUserPoolId ...
編輯:我已經在我的登錄功能,在一個工廠,是我的代碼:
login: function(username, password) {
var authenticationData = {
Username : username,
Password : password
};
var userData = {
Username :username,
Pool : poolData
};
var authenticationDetails = new AWSCognito.CognitoIdentityServiceProvider.AuthenticationDetails(authenticationData);
var cognitoUser = new AWSCognito.CognitoIdentityServiceProvider.CognitoUser(userData);
cognitoUser.authenticateUser(authenticationDetails, {
onSuccess: function (result) {
console.log('access token + ' + result.getAccessToken().getJwtToken());
/*Use the idToken for Logins Map when Federating User Pools with Cognito Identity or when passing through an Authorization Header to an API Gateway Authorizer*/
console.log('idToken + ' + result.idToken.jwtToken);
},
onFailure: function(err) {
alert(err);
},
});
}
有誰知道該怎麼辦?
我們需要的代碼來理解這個問題的背景下。 – jonode
Thansk我已編輯我的問題。 – rastafalow