Using v1.10 of amazon-cognito-identity-js in the following nodeapp.
I have written the following: This call is made after the user registration has been confirmed and the email has been verified.
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) {
}
});
When authenticateUser is called, I get the "ReferenceError: navigator is not defined"
It looks like a browser call is being attempted inside the node server.
I had created a github issue on this and the recommendation was to refer to "jsbn": "^0.1.0", "sjcl": "^1.0.3", "amazon-cognito-identity-js": "^1.10.0", "aws-sdk": "^2.5.3"
I made the changes to the package versions. Unfortunately it did not work with this too. I have created a sample nodejs app which tries to authenticate using email id and password.
NB : The Cognito pool is setup with email as an alias. The user has been created, confirmed and email verified.
Source repo : https://github.com/prem911/cognito-nodejs
Any pointers on how to solve the "navigator not found"?