auth-ts
v1.0.6
Published
AuthTS provides a wrapper for the functionallity explained [here](https://docs.microsoft.com/en-us/azure/active-directory/develop/v1-oauth2-implicit-grant-flow).
Downloads
53
Readme
AuthTS - Typescript Library for OAuth utilizing Implicit Flow
Introduction
AuthTS provides a wrapper for the functionallity explained here.
IMPORTANT NOTE: Implicit Flow is less secure than explicit flows. SSL is required for AuthTS to be secure.
Installation
npm install auth-ts
Basic Usage
To use this package, you must register an App in Azure Active Directory. You may then initialize the secure class like so:
import * as Auth from 'auth-ts'
const APP_ID: string = 'my-app-token';
const secure = new Auth.Secure(APP_ID);
To login:
secure.login();
and to logout:
secure.logout();
Logging in will follow the implicit flow process and set a cookie in your browser with the returned JsonWebToken.
Secure has two public values: user & authorized. User contains the decoded jwt. Authorized is a boolean which indicates if a user is logged in or not.