New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

autheus

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

autheus

A generic user auth/session module for front-end web apps.

latest
Source
npmnpm
Version
2.0.2
Version published
Maintainers
1
Created
Source

autheus NPM version Build status

Image

A generic user auth/session module for front-end web apps.

Installation

Install the package with NPM:

$ npm install autheus

Usage

The package exposes an Autheus singleton class, making it ideal for web browser-based, single-page apps. It has a few utility methods, which can be used like so:

import {Autheus} from "autheus";

console.log(Autheus.isSignedIn); // -> false
console.log(Autheus.token);      // -> null

Autheus.signIn("fake-auth-token");
console.log(Autheus.isSignedIn); // -> true
console.log(Autheus.token);      // -> "fake-auth-token"

Autheus.signOut();
console.log(Autheus.isSignedIn); // -> false
console.log(Autheus.token);      // -> null

Furthermore, for those utilizing react-router, the package provides a getReactRouterHooks function to aide you in managing route transitions. Example:

let [requireSignIn, requireSignOut] = Autheus.getReactRouterHooks("/sign-in", "/sign-out");
let routes = (
  <Router history={hashHistory}>
    <Route path="/" component={App}>
      <IndexRoute component={Home} onEnter={requireSignIn} />
      <Route path="sign-in" component={SignIn} onEnter={requireSignOut} />
      <Route path="sign-out" component={SignOut} onEnter={requireSignIn} />
      <Route path="*" component={NotFound} />
    </Route>
  </Router>
);

Keywords

auth

FAQs

Package last updated on 11 Aug 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts