0.2.0 • Published 3 years ago

@convergence/jwt-util v0.2.0

Weekly downloads
121
License
MIT
Repository
github
Last release
3 years ago

Convergence JWT Generator

Build Status

This project helps users easily create a JavaScript Web Token (JWT) for logging into Convergence. JWTs allow Convergnece to trust that an external system has properly authenticated a user. Convergence uses asymetric RSA Public / Private keys to generate JWTs. Convergence will store your public key. You must store your private key in a safe place. The public / private key pair sets up trust between your application and Convergence.

You can learn more about JWTs at http://jwt.io

To create a JWT key for your domain log into the Convergence Administration Console. If you have questions about generating a JWT Key Pair please consult the Convergence Developer Guide

Installation

npm install --save @convergence/jwt-util

Example Usage

The below demonstrates how you can generate a JWT in node using a private key stored on the filesystem.

var fs = require('fs');
var JwtGenerator = require('@convergence/jwt-util');

// replace with your private key
var privateKey = fs.readFileSync('test/private.key');

// Replace with your key id
var keyId = "my-convergence-key";

var gen = new JwtGenerator(keyId, privateKey);

// Provide optional information about the uers.
var claims = {
  firstName: "John",
  lastName: "Doe"
};

// Provide the username
var username = "jdoe";

// Generate the token
var token = gen.generate(username, claims);
0.2.0

3 years ago

0.1.8

7 years ago

0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago