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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@authowl/react-native

v0.3.15

Published

React Native provider, hooks, and secure session storage for AuthOwl, the multi-tenant auth SaaS.

Readme

@authowl/react-native

Complete SDK guide · Expo adapter

React Native provider, hooks, and secure session storage for AuthOwl.

Using Expo? Install @authowl/expo instead - it re-exports everything here and supplies the platform adapters for you.

npm install @authowl/react-native react-native-keychain

Why this package exists

The browser SDK leans on things a phone does not have: a cookie jar, a BroadcastChannel, and window.location redirects. This package supplies native an explicit session jar and leaves the rest to @authowl/core/native:

  1. A session that survives an app restart. React Native's fetch cookie behaviour differs between iOS and Android, is invisible to JS, and does not reliably persist. So the SDK keeps the one cookie it cares about itself, in the OS keychain, and replays it on every request. The server sees exactly what a browser would send - no native-only server mode.

The native client deliberately excludes redirect OAuth and enterprise SSO, which depend on browser state unavailable to a React Native fetch client. Passkeys are available when the app supplies its platform ceremony adapter.

Setup

import { AuthOwlProvider } from '@authowl/react-native';
import * as Keychain from 'react-native-keychain';

const storage = {
  async getItem(key) {
    const entry = await Keychain.getGenericPassword({ service: key });
    return entry ? entry.password : null;
  },
  setItem: (key, value) =>
    Keychain.setGenericPassword(key, value, { service: key }).then(() => undefined),
  removeItem: (key) => Keychain.resetGenericPassword({ service: key }).then(() => undefined),
};

export default function Root() {
  return (
    <AuthOwlProvider
      publishableKey={PUBLISHABLE_KEY}
      apiUrl="https://api.authowl.dev"
      storage={storage}
    >
      <App />
    </AuthOwlProvider>
  );
}

Use the OS keychain, not AsyncStorage. The session cookie is a bearer credential - anything holding it is the signed-in user until it expires - and AsyncStorage is unencrypted files readable by anything in the app sandbox.

There is deliberately no default storage: silently falling back to memory would make sign-in appear to work and then drop the session on the next launch.

Components

Drop-in screens built from React Native primitives, using the same localization catalogs as the web components (@authowl/core/i18n) so the wording never drifts between platforms.

import { EmailOtpForm, SignIn, SignUp, SocialButtons } from '@authowl/react-native';

<SignIn
  onSignedIn={() => router.replace('/home')}
  onSecondFactorRequired={() => router.replace('/mfa')}
/>
<SignUp onSignedUp={({ sessionCreated }) =>
  router.replace(sessionCreated ? '/home' : '/check-your-email')} />
<EmailOtpForm onSignedIn={() => router.replace('/home')} />

<SignIn /> reports success only once a session exists. A two-factor challenge is neither a failure nor a session, so it calls onSecondFactorRequired and leaves the form intact for the app to navigate to its challenge screen.

<SignUp /> reports whether a session was created. Projects that require email verification return none, and "check your email" is a different screen from "you're in".

The provider loads the project's public capabilities once. Built-in screens hide disabled methods, enforce the configured password length, collect required legal consent, and send the accepted consent version automatically.

Pass locale="ar" to <AuthOwlProvider> to render Arabic. It is not auto-detected from the device: a phone set to Arabic does not mean the app is localized, and switching only the auth screens is worse than defaulting.

Theming is a small token set, not a cascade:

import { darkTheme } from '@authowl/react-native';

<SignIn theme={darkTheme} />

Both built-in themes use AuthOwl gold (#F5B84C) for primary controls by default. Pass a custom AuthOwlTheme to a component only when the app should replace that brand color; link can optionally provide a contrast-safe inline link color distinct from the filled-control accent.

Want a different look entirely? Compose the hooks instead of fighting the components — that is what they are for.

Organizations

<OrganizationSwitcher onSwitched={(org) => refetch(org)} />

Reads the active organization from the session rather than tracking it locally, because switching re-mints the session claim server-side. The "personal account" row is off by default — many apps require an organization context to function.

Passkeys

React Native has no navigator.credentials, but both platforms have passkey APIs. Supply the ceremony from a native library and the SDK keeps the protocol:

import { Passkey } from 'react-native-passkey';
import { AuthOwlProvider, createNativePasskeys } from '@authowl/react-native';

const passkeys = createNativePasskeys({
  register: (options) => Passkey.create(options as never),
  authenticate: (options) => Passkey.get(options as never),
  // Users cancel far more often than anything breaks, so map it.
  errorCode: (error) =>
    (error as { error?: string })?.error === 'UserCancelled'
      ? 'REGISTRATION_CANCELLED'
      : undefined,
});

<AuthOwlProvider {...config} passkeys={passkeys}>

Then:

<PasskeyEnrollment name="iPhone" onEnrolled={next} onSkip={next} />
<PasskeySignInButton onSignedIn={() => router.replace('/home')} />

Without a passkeys adapter these components render nothing, and the passkey methods are absent from the client's type entirely — so an app cannot call a prompt the platform could never show. That also means it is safe to drop <PasskeyEnrollment /> into a post-sign-up flow that runs on projects with passkeys disabled.

Both need associated-domain configuration (webcredentials: on iOS, Digital Asset Links on Android) that the SDK cannot do on your behalf.

Social buttons

<SocialButtons /> takes the provider SDKs from your app, because they differ per provider and platform and bundling one would force it on every consumer:

<SocialButtons
  providers={[{
    id: 'google',
    label: 'Google',
    // Return null when the user cancels - that is not an error.
    getIdToken: async () => {
      const result = await GoogleSignin.signIn();
      return result.idToken ? { token: result.idToken } : null;
    },
  }]}
  onSignedIn={() => router.replace('/home')}
/>

Hooks

const { isLoaded, isSignedIn, user, signOut, has } = useAuth();

if (!isLoaded) return <Splash />;
if (!isSignedIn) return <SignInScreen />;

// Advisory only - for hiding UI the user cannot use. The real boundary is
// server-side, over a verified token.
if (has({ permission: 'org:billing:read' })) return <Billing />;
  • useAuth() - the primary hook: user, session, signOut, has, hasPermission
  • useUser() - the signed-in user, or null
  • useSession() - raw session state (isPending, error, refetch)
  • useAuthOwlClient() - native-safe sign-in, account, organization, and passkey management actions
  • useSocialSignIn() - exchanges a provider-issued ID token for an AuthOwl session

Social sign-in

Obtain an ID token with the provider's native SDK, then exchange it through the hook. The request and session response use the same secure cookie jar.

const signInWith = useSocialSignIn();
const result = await signInWith({
  provider: 'google',
  idToken: { token: googleResult.idToken },
});

Redirect OAuth is not exposed because the AuthOwl fetch cookie jar and a system browser do not share the OAuth state cookie. A deep link alone cannot establish the app session safely.

License

MIT