Socket
Book a DemoInstallSign in
Socket

@withyouwithme/promisify-auth0

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@withyouwithme/promisify-auth0

Make Auth0-js work with promises instead of callbacks.

9.6.1
latest
Source
npmnpm
Version published
Weekly downloads
1
-80%
Maintainers
1
Weekly downloads
 
Created
Source

promisify-auth0-js

Promisifying wrapper around the Client Side Javascript toolkit for Auth0 API

Known Vulnerabilities

Install

From npm

npm i --save promisify-auth0

Basic Usage

The package is mirroring the original auth0.js API. The only difference is that instead of NodeJS callback function style, promisify-auth0 allows you to get Promise<T> instead which help avoid callback hell and play nicely with async/await.

You will still need to create an original Auth0 objects and inject them into the corresponding wrapping types, something like this:

import { Authentication as NativeAuthentication } from 'auth0-js';
import { Authentication } from 'promisify-auth0';

const nativeAuthentication: NativeAuthentication = ...;
const authentication = new Authentication(nativeAuthentication);

const options = { realm: '...', audience: '...', username: '...', password: '...', scope: '...' };

authentication.login(options)
  .then(loginResult => {
    // ...
  })
  .catch(caughtError => {
    // ...
  });

The last piece of code could be rewritten in a more imperative style while maintaining the asyncronous execution model.

try {
  const loginResult = await authentication.login(options);
  // ...
} catch (caughtError) {
  // ...
}

License and other

This code is distributed under MIT license.

Please respect the Code of Conduct.

Feel free to contribute.

Keywords

auth0

FAQs

Package last updated on 10 Oct 2018

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.