frau-jwt
v3.1.0
Published
Utility to get a JWT from a FRA
Downloads
4,987
Readme
frau-jwt
Simple utility to get a json web token in a D2L free range application (frau).
Install
npm install frau-jwt --save
Usage
import jwt from 'frau-jwt';
const token = await jwt('a:b:c');
API
jwt([String scope][, Object opts])
-> Promise<String>
Requests a JWT with the given scope and opts from the hosting LMS. If in an ifrau, the request will be delegated to the frame host.
The resulting token will be cached until it expires.
scope String
(*:*:*:
)
If scope is provided, then it will be sent as the request scope of the token. It should be a properly formatted String, with scopes seperated by spaces.
jwt();
jwt('foo:bar:baz');
jwt('a:b:c x:y:z');
opts Object
If an opts object is provided, the following options will be checked for:
Option: extendSession Boolean
(true)
You may optionally specify whether you want the user's sessions to be extended by the act of fetching the token.
jwt();
jwt({ extendSession: false });
jwt('foo:bar:baz', { extendSession: false });
Testing
npm test
Versioning and Releasing
This repo is configured to use semantic-release
. Commits prefixed with fix:
and feat:
will trigger patch and minor releases when merged to main
.
To learn how to create major releases and release from maintenance branches, refer to the semantic-release GitHub Action documentation.