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

a7k-react-native-twitter-auth

v0.1.8

Published

A lightweight React Native library for authenticating users with X (formerly Twitter) in mobile applications.

Downloads

855

Readme

a7k-react-native-twitter-auth

React Native OAuth 1.0a authentication for X (Twitter). Works with Expo (managed/bare) and bare React Native.

Requirements

Installation

# npm
npm install a7k-react-native-twitter-auth react-native-inappbrowser-reborn

# yarn
yarn add a7k-react-native-twitter-auth react-native-inappbrowser-reborn

iOS — link native modules:

cd ios && pod install

Setup

1. Deep link scheme

Expo (app.json):

{
  "expo": {
    "scheme": "myapp"
  }
}

Bare React Nativeios/Info.plist:

<key>CFBundleURLTypes</key>
<array>
  <dict>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>myapp</string>
    </array>
  </dict>
</array>

android/app/src/main/AndroidManifest.xml (inside your main <activity>):

<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:scheme="myapp" android:host="callback" />
</intent-filter>

2. X Developer Portal

developer.twitter.com → your app → User authentication settings:

  • Enable OAuth 1.0a
  • App permissions: Read (minimum)
  • Callback URLs:
    • myapp:// (iOS)
    • myapp://callback/ (Android)

Changing auth settings invalidates existing keys — regenerate your consumer key and secret after saving.

Usage

import { TwitterAuthProvider } from 'a7k-react-native-twitter-auth';
import type { TwitterAuthResult } from 'a7k-react-native-twitter-auth';

// Instantiate once, outside the component
const twitterAuth = new TwitterAuthProvider({
  clientId: process.env.TWITTER_CONSUMER_KEY!,
  clientSecret: process.env.TWITTER_CONSUMER_SECRET!,
  appScheme: 'myapp',
});

export default function App() {
  const handleSignIn = async () => {
    try {
      const result: TwitterAuthResult = await twitterAuth.login();
      // result.oauthToken       — access token for API calls
      // result.oauthTokenSecret — store securely (e.g. SecureStore / Keychain)
      // result.oauthVerifier    — returned for completeness; not needed after this step
    } catch (error) {
      // 'Twitter login cancelled or error'  — user dismissed the browser
      // 'InAppBrowser is not available...'  — running in Expo Go or missing native build
      // HTTP errors from Twitter            — bad credentials or misconfigured callback URL
    }
  };

  return <Button title="Sign in with X" onPress={handleSignIn} />;
}

API

new TwitterAuthProvider(options)

| Option | Type | Description | |---|---|---| | clientId | string | Consumer key from the X Developer Portal | | clientSecret | string | Consumer secret from the X Developer Portal | | appScheme | string | Deep link scheme registered in your app and Twitter callback URLs |

twitterAuth.login()

login(): Promise<TwitterAuthResult>

Opens the X auth flow in an in-app browser. Resolves with tokens on success; throws on cancellation or error.

TwitterAuthResult

| Field | Type | Description | |---|---|---| | oauthToken | string \| undefined | Access token — use in Authorization headers for X API v1.1 calls | | oauthTokenSecret | string \| undefined | Access token secret — store securely, never log or expose | | oauthVerifier | string \| undefined | OAuth verifier — exchanged for the access token internally |

Running a native build

# Expo
npx expo run:ios
npx expo run:android

# Bare React Native
npx react-native run-ios
npx react-native run-android

Contributing

License

MIT