How to use react-native-auth0 - 1 common examples

To help you get started, we’ve selected a few react-native-auth0 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github streamplace / streamplace / packages / streamplace-ui / src / auth / auth.native.js View on Github external
import Auth0 from "react-native-auth0";
import SP from "sp-client";
import {
  TOKEN_STORAGE_KEY,
  PROFILE_STORAGE_KEY,
  AUTH0_DOMAIN,
  AUTH0_CLIENT_ID,
  AUTH0_REALM,
  ID_TOKEN
} from "../constants";
import { AsyncStorage } from "react-native";
import jwtDecode from "jwt-decode";

const auth0 = new Auth0({
  domain: AUTH0_DOMAIN,
  clientId: AUTH0_CLIENT_ID
});

/**
 * no-op; exists for API compatibility with the web auth module
 */
export async function checkLogin() {
  const token = await AsyncStorage.getItem(TOKEN_STORAGE_KEY);
  const user = await SP.connect({ token });
  // Allow the API server to issue us a new token, then...
  await AsyncStorage.setItem(TOKEN_STORAGE_KEY, SP.token);
  return user;
}

export async function login({ email, password }) {

react-native-auth0

React Native toolkit for Auth0 API

MIT
Latest version published 6 months ago

Package Health Score

72 / 100
Full package analysis

Popular react-native-auth0 functions