How to authenticate Cognito user pool in node js

Question:

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.

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”?

Answer:

To save some googling time there is no fix for the above error at the time of writing this but there is a workaround:

AWS Cognito unauthenticated login error (window is not defined) [JS]

Leave a Reply