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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@fast-auth-near/react-native-provider

v1.0.0-beta.1

Published

React Native provider for FastAuth - Adapts react-native-auth0 to the FastAuth provider interface

Downloads

7

Readme

@fast-auth/react-native-provider

React Native provider for FastAuth - Adapts react-native-auth0 to the FastAuth provider interface.

Overview

This package provides a React Native implementation of the FastAuth provider interface using react-native-auth0. It allows React Native applications to use FastAuth for NEAR Protocol authentication and transaction signing.

Features

  • 🔐 Auth0 Integration: Built on top of react-native-auth0
  • 📱 React Native First: Designed specifically for React Native applications
  • 🎯 Type-safe: Full TypeScript support
  • 🔄 Automatic Credential Management: Handles token storage and refresh automatically
  • 🌐 Universal Login: Uses Auth0's Universal Login in the system browser
  • 📦 Zero-config: Works out of the box with sensible defaults

Installation

npm install @fast-auth/react-native react-native-auth0 near-api-js
# or
pnpm add @fast-auth/react-native react-native-auth0 near-api-js
# or
yarn add @fast-auth/react-native react-native-auth0 near-api-js

Additional Setup

Since this package uses react-native-auth0, you need to configure your React Native project according to the react-native-auth0 documentation.

Usage

Basic Setup with FastAuth React SDK

import { FastAuthProvider } from '@fast-auth/react-sdk';
import { reactNativeProviderConfig } from '@fast-auth/react-native-provider';
import { Connection } from 'near-api-js';

// Configure NEAR connection
const connection = new Connection({
  networkId: 'testnet',
  provider: { type: 'JsonRpcProvider', args: { url: 'https://rpc.testnet.near.org' } },
});

// Configure FastAuth network
const network = {
  mpcContractId: 'v1.signer-prod.testnet',
  fastAuthContractId: 'fastauth.testnet',
};

function App() {
  // Configure the ReactNative provider with Auth0 credentials
  const providerConfig = reactNativeProviderConfig({
    domain: 'your-domain.auth0.com',
    clientId: 'your-client-id',
    imageUrl: 'https://your-app.com/icon.png',
    name: 'Your App Name',
    audience: 'your-api-identifier', // optional
  });

  return (
    <FastAuthProvider
      providerConfig={providerConfig}
      connection={connection}
      network={network}
    >
      <YourApp />
    </FastAuthProvider>
  );
}

export default App;

Using the Provider Directly

You can also use the ReactNativeProvider directly without the React SDK:

import { ReactNativeProvider } from '@fast-auth/react-native';

const provider = new ReactNativeProvider({
  domain: 'your-domain.auth0.com',
  clientId: 'your-client-id',
  audience: 'your-api-identifier',
});

// Check if user is logged in
const isLoggedIn = await provider.isLoggedIn();

// Login
await provider.login();

// Get user path
const path = await provider.getPath();

// Logout
await provider.logout();

With FastAuth React Hooks

import { useFastAuth } from '@fast-auth/react';
import { View, Button, Text } from 'react-native';

function LoginScreen() {
  const { login, logout, isLoggedIn, isLoading } = useFastAuth();

  if (isLoading) {
    return <Text>Loading...</Text>;
  }

  return (
    <View>
      {isLoggedIn ? (
        <Button title="Logout" onPress={logout} />
      ) : (
        <Button title="Login" onPress={() => login()} />
      )}
    </View>
  );
}

API Reference

ReactNativeProvider

Constructor Options

type ReactNativeProviderOptions = {
  domain: string;        // Your Auth0 domain (e.g., 'your-tenant.auth0.com')
  clientId: string;      // Your Auth0 client ID
  imageUrl: string;      // URL of the app image to display in authorization UI
  name: string;          // Name of your application
  audience?: string;     // Optional: Your API identifier in Auth0
  timeout?: number;      // Optional: Request timeout in milliseconds
  headers?: Record<string, string>; // Optional: Additional headers
};

Error Handling

The provider throws ReactNativeProviderError with the following error codes:

  • USER_NOT_LOGGED_IN: User is not authenticated
  • CREDENTIALS_NOT_FOUND: No valid credentials found
  • INVALID_TOKEN: The JWT token is invalid or missing required claims
import { ReactNativeProviderError, ReactNativeProviderErrorCodes } from '@fast-auth/react-native';

try {
  const path = await provider.getPath();
} catch (error) {
  if (error instanceof ReactNativeProviderError) {
    if (error.message === ReactNativeProviderErrorCodes.USER_NOT_LOGGED_IN) {
      // Handle not logged in case
    }
  }
}

Auth0 Configuration

Required Auth0 Settings

  1. Allowed Callback URLs: Add your app's callback URL

    yourapp://your-domain.auth0.com/ios/yourapp/callback
    yourapp://your-domain.auth0.com/android/yourapp/callback
  2. Allowed Logout URLs: Add your app's logout URL

    yourapp://your-domain.auth0.com/ios/yourapp
    yourapp://your-domain.auth0.com/android/yourapp
  3. Grant Types: Enable the following grant types:

    • Authorization Code
    • Refresh Token
  4. API Configuration (if using audience):

    • Create an API in Auth0
    • Use the API identifier as the audience parameter

iOS Specific Configuration

Add the following to your Info.plist:

<key>CFBundleURLTypes</key>
<array>
  <dict>
    <key>CFBundleTypeRole</key>
    <string>None</string>
    <key>CFBundleURLName</key>
    <string>auth0</string>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>yourapp</string>
    </array>
  </dict>
</array>

Android Specific Configuration

Update android/app/src/main/AndroidManifest.xml:

<activity
  android:name="com.auth0.android.provider.WebAuthActivity"
  android:exported="true">
  <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data
      android:host="your-domain.auth0.com"
      android:pathPrefix="/android/${applicationId}/callback"
      android:scheme="${applicationId}" />
  </intent-filter>
</activity>

Platform Support

  • ✅ iOS
  • ✅ Android
  • ⚠️ Web (uses react-native-auth0's web implementation)

License

MIT

Related Packages