pre*_*911 6 amazon-web-services node.js aws-cognito
在以下nodeapp中使用amazon-cognito-identity-js的v1.10.
我写了以下内容:此通话是在用户注册确认并且电子邮件已经过验证后进行的.
var AWS = require('aws-sdk');
var AWSCognito = require('amazon-cognito-identity-js');
router.post('/emailsignin', function(req, res, next) {
var email = req.body.email;
var pwd = req.body.password;
AWS.config.region = 'eu-west-1';
var poolData = {
UserPoolId : AWS_USERPOOLID,
ClientId : AWS_APPCLIENTID
};
var userPool = new AWS.CognitoIdentityServiceProvider.CognitoUserPool(poolData);
var authenticationData = {
Username : email,
Password : pwd,
};
var authenticationDetails = new AWS.CognitoIdentityServiceProvider.AuthenticationDetails(authenticationData);
var userData = {
Username : email,
Pool : userPool
};
var cognitoUser = new AWS.CognitoIdentityServiceProvider.CognitoUser(userData);
cognitoUser.authenticateUser(authenticationDetails, {
onSuccess: function (result) {
},
onFailure: function(err) {
}
});
Run Code Online (Sandbox Code Playgroud)
调用authenticateUser时,我得到"ReferenceError:navigator未定义"
看起来在节点服务器内尝试浏览器调用.
我在此创建了一个github问题,建议是引用"jsbn":"^ 0.1.0","sjcl":"^ 1.0.3","amazon-cognito-identity-js":"^ 1.10 .0","aws-sdk":"^ 2.5.3"
我对包版本进行了更改.不幸的是它也不适用于此.我创建了一个示例nodejs应用程序,它尝试使用电子邮件ID和密码进行身份验证.
注意:Cognito池设置为使用电子邮件作为别名.用户已创建,确认并通过电子邮件验证.
来源回购:https://github.com/prem911/cognito-nodejs
有关如何解决"未找到导航器"的任何指示?
| 归档时间: |
|
| 查看次数: |
2787 次 |
| 最近记录: |