Authentication JS Module

Overview

The AirMap Authentication JS Module allows developers to easily add authentication to their web app. The Auth module provides a Lock user interface that allows users to login to AirMap, which is required to interact with certain APIs.

Requirements

You must have an AirMap Developer account to use the AirMap Auth module. If you do not have an account, sign up for one at the AirMap Developer Portal.

To use the AirMap Auth module, a client_id must be generated when creating your application and obtaining in the Developer Portal. Additionally, a callback_url must be provided to AirMap in order to whitelist the use of the module. The Developer Portal provides a config file that contains all of the required information to conveniently place in your app (see example below).

Installation

The Auth module is open-source and available from a variety of sources:

Github

https://github.com/airmap/js-auth

AirMap CDN

<!-- Latest patch release -->
<script src="https://cdn.airmap.io/js/auth/1.3.2/airmap-auth.min.js"></script>

<!-- Latest minor release -->
<script src="https://cdn.airmap.io/js/auth/v1.3/index.min.js"></script>

Bower

bower install airmap-auth

<script src="bower_components/airmap-auth/index.min.js"></script>

NPM

npm install airmap-auth

After installing the airmap-auth module, you'll need bundle it up along with all of its dependencies using a tool like webpack or browserify. If you don't have a build process in place for managing dependencies, it is recommended that you use the module via bower or the CDN.

Example

An example of the Auth module is included in the Github repository.

  1. Clone the repo and run npm install.
  2. Visit the AirMap Developer Portal and ensure the Callback URL is set in the Auth0 section (for this example, we are using https://localhost:8080/). Adding a Callback URL will allow you to generate an Auth0 Client ID.
  1. Copy the Config JSON object and paste into /examples/index.js
  1. Run npm start in the root directory and navigate to https://localhost:8080

Updated 12 months ago

Authentication JS Module


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.