-
Go to AWS Cognito User Pools.
-
Specifics:
- For machine-to-machine, disable MFA enforcement.
- Enable the Cognito Hosted UI to obtain a Cognito Domain (necessary for communicating with
/auth2/token
). - Create a resource server with the scope
read
and Resource Server Identifierforms
.
-
Save the User Pool ID, Cognito Domain and the region in your
.env
file.
- Set your AWS keys.
- Install dependencies:
npm install
- Start the server:
node_modules/.bin/nodemon .
- In your browser, call:
http://localhost:3000/api/createAppClient
. This will create the asymmetric keys for signing the JWT and the client ID/secret metadata, which the client will need to store securely.
Run the client test:
node client_test.js
- Create and Verify JWTs with Node
- Node AWS Cognito API Example
- YouTube Tutorial on AWS Cognito
- RFC 7523: JSON Web Token (JWT) Profile for OAuth 2.0 Client Authentication and Authorization Grants
- Protect Public Clients for Amazon Cognito Using an Amazon CloudFront Proxy
- AWS Cognito Token Endpoint Documentation