当我尝试进行
authenticateUser
时,出现以下错误:Error: Unable to verify secret hash for client <CLIENT_ID_HERE>
。我的代码如下:import {
Config,
CognitoIdentityCredentials
} from "aws-sdk"
import {
CognitoUserPool,
CognitoUserAttribute,
AuthenticationDetails,
CognitoUser
} from "amazon-cognito-identity-js"
Config.region = "ap-northeast-2"
var userpool = new CognitoUserPool({
UserPoolId: "ap-northeast-2_QosOiWMkd",
ClientId: "1bd6s9mv98bo2lucen2vesbqls"
})
var userData = {
Username: "jiewmeng@gmail.com",
Pool: userpool
}
var authData = new AuthenticationDetails({
Username: "jiewmeng@gmail.com",
Password: "P@$$w0rd"
})
var cognitoUser = new CognitoUser(userData)
cognitoUser.authenticateUser(authData, {
onSuccess: function (result) {
console.log("authenticated with", result)
},
onFailure: function (err) {
console.error(err)
}
})
在AWS上,客户端密钥已经被禁用。