在 Postman 中工作我正在尝试使用节点的 aws-sdk 从 Cognito 调用 jwtToken 但我收到以下错误:
评估预请求脚本时出错:错误:找不到模块“aws-sdk”
这是我的密码:
const AWS = require('aws-sdk');
var authenticationData = {
Username: 'username',
Password: 'password',
};
var authenticationDetails = new
AmazonCognitoIdentity.AuthenticationDetails(authenticationData);
var poolData = {
UserPoolId: 'us-east-1_xxxxxx',
ClientId: 'xxxxx'
};
var userPool = new AmazonCognitoIdentity.CognitoUserPool(poolData);
var userData = {
Username: 'username',
Pool: userPool
};
var cognitoUser = new AmazonCognitoIdentity.CognitoUser(userData);
cognitoUser.authenticateUser(authenticationDetails, {
onSuccess: function(result) {
var accessToken = result.getAccessToken().getJwtToken();
var idToken = result.idToken.jwtToken;
},
});
pm.globals.set("token", idToken);
到目前为止,我运行的唯一命令是:brew install node 和npm install aws-sdk
我确定我缺少某种配置来调用模块,任何帮助都可以!谢谢!