我想从AWS获取身份验证令牌;但是,我只收到一个错误,告诉我客户端id不正确。
我很高兴在网上找到了这段代码,link:https://docs.aws.amazon.com/cognito/latest/developerguide/authentication.html和我能够调用最后一个函数调用,但它抱怨ClientId,我不知道从哪里获取客户端I :-(
我不确定从哪里获取客户端Id和用户池Id?
在AWS网站上也有一个客户端应用程序Id。
我正在寻找的东西,我只需要提供用户I和密码使用节点js?
const AmazonCognitoIdentity =require(‘amazon-cognito identity-js’);
var authenticationData ={用户名:'...',密码:'...',};
var authenticationDetails = new AmazonCognitoIdentity.AuthenticationDetails(authenticationData);
var poolData = {
UserPoolId : '...', // From where on the AWS web site can I fetch the correct User Pool Id?
ClientId : '...' // From where on the AWS web site can I fetch the correct client Id?
};
var userPool = new AmazonCognitoIdentity.CognitoUserPool(poolData);
var userData = {
Username : 'karlschmitt',
Pool : userPool
};
var cognitoUser = new AmazonCognitoIdentity.CognitoUser(userData);
cognitoUser.authenticateUser(authenticationDetails, {
onSuccess: function (result) {
var accessToken = result.getAccessToken().getJwtToken();
/* Use the idToken for Logins Map when Federating User
Pools with identity pools or when passing through an
Authorization Header to an API Gateway Authorizer */
var idToken = result.idToken.jwtToken;
console. log("Successful!");
},
onFailure: function(err) {
// alert(err);
console. log("Failure!" + err.message);
},
});https://stackoverflow.com/questions/65753520
复制相似问题