cognitocurl
CLI for making AWS Cognito signed requests to API Gateway
Last updated 3 months ago by khola .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install cognitocurl 
SYNC missed versions from official npm registry.

cognitocurl ????

This is CLI tool that allows you to easily sign curl calls to API Gateway with Cognito authorization token.

npm version

Why?

AWS Cognito is really powerful, especially combined with API Gateway, but if you use Cognito Authorizer or Lambda Authorizer based on Authorization header, you may encounter a problem with signing curl calls - this is why we created cognitocurl - it is tiny CLI tool made with Node.js that takes care of signing in against user pool, persisting and rotating tokens, and adding additional header to your curl call.

Made with ❤️ in Nordcloud

Usage

Installation:

$ npm i -g cognitocurl

Then:

$ cognitocurl --cognitoclient XXX --userpool YYY --run "full curl command here"

or

$ cognitocurl --hostedui hosteduisetupfilename.json --run "full curl command here"

Available flags

Tools:

  • --version
  • --help

Features:

  • --cognitoclient cognitoclientid - Cognito Client ID
  • --userpool userpoolid - Cognito User Pool ID
  • --header header - Defaults to 'Authorization'
  • --reset - Reset cached Cognito credentials
  • --run "runcommand" - pass your curl command here
  • --hostedui hostedui.json - if passed, Congito Hosted UI will be launched and configured using setup from provided json file
  • --token - if passed, run command will be ignored and access token will be printed to stdout instead

Hosted UI json setup example

If you want to use hosted ui, provide --hostedui. You should provide a setup jsonfile file like this:

{
  "region": "eu-west-1",
  "userPoolId": "your_user_pool_id",
  "userPoolWebClientId": "your_web_client_id",
  "redirectSignIn": "http://localhost:3000",
  "redirectSignOut": "http://localhost:3000",
  "domain": "your_hosted_ui_domain"
}

Note that lochalhost:3000 should be added to your Cognito User Pool App Client setup!

Plans for the future

  • add federated/social logins (by opening browser window)

Authors

  • Jakub Holak, Nordcloud ????????

Credits

Done using oclif. Inspired by AWS Amplify.

Current Tags

  • 0.1.8                                ...           latest (3 months ago)

16 Versions

  • 0.1.8                                ...           3 months ago
  • 0.1.7                                ...           3 months ago
  • 0.1.6                                ...           3 months ago
  • 0.1.5                                ...           5 months ago
  • 0.1.4                                ...           5 months ago
  • 0.1.3                                ...           5 months ago
  • 0.1.2                                ...           5 months ago
  • 0.1.1                                ...           8 months ago
  • 0.1.0                                ...           9 months ago
  • 0.0.7                                ...           10 months ago
  • 0.0.6                                ...           10 months ago
  • 0.0.5                                ...           10 months ago
  • 0.0.4                                ...           a year ago
  • 0.0.3                                ...           a year ago
  • 0.0.2                                ...           a year ago
  • 0.0.1                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 17
Dependencies (19)
Dev Dependencies (7)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |