apalaniuk / frau-jwt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

frau-jwt

NPM version Build status Coverage Status Dependency Status

Simple utility to get a json web token in a D2L free range application (frau).

Install

npm install frau-jwt --save

Usage

var jwt = require('frau-jwt');

jwt('a:b:c')
	.then(function (token) {
		// do a thing with the token
	});

API


jwt([String scope]) -> Promise<String>

Requests a JWT with the given scope 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.

Optional: scope

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. Defaults to *:*:*.

Examples
  • foo:bar:baz
  • a:b:c x:y:z

Testing

npm test

Contributing

  1. Fork the repository. Committing directly against this repository is highly discouraged.

  2. Make your modifications in a branch, updating and writing new unit tests as necessary in the spec directory.

  3. Ensure that all tests pass with npm test

  4. rebase your changes against master. Do not merge.

  5. Submit a pull request to this repository. Wait for tests to run and someone to chime in.

Code Style

This repository is configured with EditorConfig and ESLint rules.

About

License:Apache License 2.0


Languages

Language:JavaScript 100.0%