GoInstant Authentication for Your Node.js Application
This is an implementation of JWT tokens consistent with what's specified in the GoInstant Users and Authentication Guide.
This library is not intended as a general-use JWT library; see JWT-php for that. At the time of this writing, GoInstant supports the JWT IETF draft version 8.
npm install --save goinstant-auth
Construct a signer with your goinstant application key. The application key should be in base64url or base64 string format. To get your key, go to your goinstant dashboard and click on your App.
⚠️ Remember, the Secret Key needs to be treated like a password! Never share it with your users!
var Signer = Signer;var signer = yourGoInstantAppKey;
You can then use this
signer to create as many tokens as you want. The
domain parameter should be replaced with your website's domain. Groups are
Signer object from a base64url or base64 secret key string.
Throws an Error if the
secretKey could not be parsed.
Creates a JWT as a JWS in Compact Serialization format. Can be called multiple times on the same object, saving you from having to load your secret GoInstant application key every time.
userData is an Object with the following required fields, plus any other
custom ones you want to include in the JWT.
domain- the domain of your website
id- the unique, permanent identity of this user on your website
displayName- the name to initially display for this user
groups- an array of groups, each group requiring:
id- the unique ID of this group, which is handy for defining GoInstant ACLs
displayName- the name to display for this group
extraHeaders is completely optional. It's used to define any additional
JWS header fields
that you want to include.
Synchronous version of
sign(), returning the token string. Throws an
exception if the token could not be created.
userData maps to the following JWT claims.
The authoritative list of claims used in GoInstant can be found in the Users and Authentication Guide.
dn(GoInstant private claim)
g(GoInstant private claim)
id(GoInstant private claim)
dn(GoInstant private claim)
aud(standard claim) automatically added
extraHeaders parameter in
typ headers will
be overridden by this library.
If you'd like to contribute to or modify node-goinstant-auth, here's a quick guide to get you started.
Download via GitHub and install npm dependencies:
git clone email@example.com:goinstant/node-goinstant-auth.gitcd node-goinstant-authnpm install
Testing is with the mocha framework. Tests are located in the
npm test # uses the locally-installed mocha
npm version patch(increments
z.y.x, then makes a commit for package.json, tags that commit)
git push --tags origin master
Go to https://npmjs.org/package/goinstant-auth and verify it published (can take several minutes)
For responsible disclosures, email GoInstant Security.
© 2013 GoInstant Inc., a salesforce.com company. All Rights Reserved.
Licensed under the 3-clause BSD license