These steps demonstrate how to get the JavaScript library for AWS Cognito integration when using simple HTML and JavaScript - no frameworks like ReactJS, or other Node type projects.
Even though you may not want to use a framework, you still require a relatively new stable version of nodejs
My approach:
- Download the Linux
tar.gz
file - Unzip in
~/opt/apps
- In
~/.zshrc
create a symlink to the binary directory, for example:export PATH=$PATH:~/opt/apps/node-v16.15.0-linux-x64/bin
- For the installation to take effect, just source the script again or open a new terminal
In this example, I have my plain HTML and JavaScript files in ~/tmp/poc
Steps:
- Create a temporary directory to install Amplify Package:
mkdir ~/tmp/node-temp
and change into this directory - Run:
npm i amazon-cognito-identity-js
- Copy the required file to the working source directory:
cp -vf node_modules/amazon-cognito-identity-js/dist/amazon-cognito-identity.min.js ~/tmp/poc/
And that is all that is required. You can now use the library. Some useful example can be found in the Amplify Project