npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-auth0-plus

v1.0.0

Published

Added missing functions to react-native-auth0

Downloads

1

Readme

React Native Auth0 Plus

Added missing functions of react-native-auth0 for full native authentication flow.

For example, there is no API of react-native-auth0 to handle mfa_required error during MFA Login. This library provides APIs to:

  1. Query user's existing authenticators (e.g. sms, one-time-password, etc...).
  2. If authenticators exist, challenge users with their registered authenticators (e.g. send sms code to user's phone).
  3. Otherwise, associate specific authenticator (e.g. sms, email, etc...) with users.

This is an unofficial library, all its features should be considered as alternatives. Developers should always check if latest official library (react-native-auth0) has implemented the same features before using this library.

Usages

import {
    default as Auth0Plus,
    AuthenticatorType,
    OobChannel
} from 'react-native-auth0-plus';

const helper = new Auth0Plus('<client-id>', '<domain>');

For brevity, the rest of the examples will leave out the import and/or instantiation step.

Query user's existing authenticators

Query sms authenticators ONLY

const [{ id: smsAuthenticatorId }] = await helper.queryAuthenticators({
    mfa_token,
    oob_channel: OobChannel.sms,
    authenticator_type: AuthenticatorType.oob
});

Query all authenticators

const allAuthenticators = await helper.queryAuthenticators({
    mfa_token
});

Associate users with their phone number or email

After querying user's authenticators and find that user has not associated with specific authenticators. Your app prompts users to input phone numbers or email addresses, sends request to associate with these peronal information and get response of OOB Code.

// sms
const { oob_code, recovery_codes, ...} = await helper.associatePhone({ mfa_token, phone_number });

// email
const { oob_code, recovery_codes, ...} = await helper.associateEmail({ mfa_token, email });

// General request
const { oob_code, recovery_codes, ...} = await helper.associate({ ... })

Challenge users

After querying user's authenticators and find that user has associated with some authenticators (got authenticator id), Your app challenge these authenticators by using react-native-auth0.multifactorChallenge(...) or shortcut of this library.

const oobCode = await helper.challengeOob({
    authenticator_id,
    mfa_token,
})

The oobCode is required for next login flow.