JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5760
  • Score
    100M100P100Q136701F
  • License Apache-2.0

Provides a middleware function for wrapping a window.Request object with d2l authentication for use with d2l-fetch

Package Exports

  • d2l-fetch-auth
  • d2l-fetch-auth/d2l-fetch-auth.js
  • d2l-fetch-auth/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (d2l-fetch-auth) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

d2l-fetch-auth

NPM version

Provides a middleware function for wrapping a window.Request object with d2l authentication for use with d2l-fetch.

Installation

Install from NPM:

npm install d2l-fetch-auth

Usage

Reference the script in your html after your reference to d2l-fetch (see here for details on d2l-fetch):

<script type="module">
import auth from 'd2l-fetch-auth/d2l-fetch-auth.js';
</script>

Alternatively, if you are making requests from within the context of an iFramed Free Range Application (iFRA), reference the framed script:

<script type="module">
import auth from 'd2l-fetch-auth/d2l-fetch-auth-framed.js';
</script>

This will import the auth middleware function.

Auth

Install the auth middleware to d2lfetch via the use function and then start making your requests.

d2lfetch.use({name: 'auth', fn: auth});

const response = await d2lfetch.fetch(
    new Request('http://example.com/api/entity/1')
);

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.