JWT CLI for GoInstant
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
.gitignore
LICENSE
README.md
app.js
package.json

README.md

goinstant-jwt-cli

GoInstant Authentication in the Command Line

This is an implementation of the GoInstant node-goinstant-auth module to allow for JWT generation in the command line.

Installation

npm install

Usage

Get your secret key for your app from your goinstant dashboard.

⚠️ Remember, the Secret Key needs to be treated like a password!

There are two ways to use the GoInstant JWT CLI. Without a config file, do the following and give your Secret Key when asked.

node app.js

Alternatively, you can create a config file at config/config.js that looks like this:

module.exports = {
  APP_NAME: 'APP_SECRET_KEY',
  ANOTHER_APP_NAME: 'ANOTHER_APP_SECRET_KEY'
};

With this config file in place you will be able to use the CLI repeatedly for the same app, without having to retrieve your secret key each time:

node app.js APP_NAME

or

node app.js ANOTHER_APP_NAME

The returned JWT can then be used in order to test user authentication locally, without the need for any server.

Technicals

The authoritative list of claims used in GoInstant can be found in the Users and Authentication Guide.

  • domain -> iss (standard claim)
  • id -> sub (standard claim)
  • displayName -> dn (GoInstant private claim)
  • groups -> g (GoInstant private claim)
    • id -> id (GoInstant private claim)
    • displayName -> dn (GoInstant private claim)
  • 'goinstant.net' -> aud (standard claim) automatically added

The extraHeaders parameter is NOT supported at this time.

Dependencies

  • node.js >= 0.10
    • 0.11.7 and below cannot be used due to bugs in HMAC streams

Set-Up

Download via GitHub and install npm dependencies:

git clone git@github.com:tmyrden/goinstant-jwt-cli.git
cd goinstant-jwt-cli

npm install