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

@thewoowon/google-rn

v0.1.4

Published

Lightweight, secure, and 100% free Google OAuth2 library for React Native

Readme

@thewoowon/google-rn

npm version license downloads TypeScript

Lightweight, secure, and 100% free Google OAuth2 library for React Native

InstallationUsageAPIPlatform SetupContributing


✨ Features

  • 🚀 Easy to use - Simple React hook API
  • 🔒 Secure - PKCE flow, state validation, secure token storage
  • 📱 Cross-platform - iOS & Android support
  • 🎯 TypeScript - Full type safety with complete type definitions
  • 🆓 100% Free - No subscriptions, no hidden costs
  • 🪶 Lightweight - Minimal dependencies
  • 🔧 Flexible - Customizable scopes and configuration
  • 📦 Well-documented - Comprehensive guides and examples

Installation

yarn add @thewoowon/google-rn
# or
npm install @thewoowon/google-rn

Dependencies

This package requires the following peer dependencies:

yarn add @react-native-async-storage/async-storage react-native-get-random-values

Usage

Basic Example

import React from 'react';
import { View, Button, Text } from 'react-native';
import { useGoogleAuth } from '@thewoowon/google-rn';

function App() {
  const { user, loading, signIn, signOut, isAuthenticated } = useGoogleAuth();

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

  return (
    <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
      {isAuthenticated ? (
        <>
          <Text>Welcome, {user?.name || user?.email}!</Text>
          <Button title="Sign Out" onPress={signOut} />
        </>
      ) : (
        <Button title="Sign In with Google" onPress={signIn} />
      )}
    </View>
  );
}

export default App;

Getting Access Token

import { useGoogleAuth } from '@thewoowon/google-rn';

function MyComponent() {
  const { getAccessToken } = useGoogleAuth();

  const callApi = async () => {
    const token = await getAccessToken();
    if (token) {
      // Use the token for API calls
      const response = await fetch('https://api.example.com/data', {
        headers: {
          Authorization: `Bearer ${token}`,
        },
      });
    }
  };

  return <Button title="Call API" onPress={callApi} />;
}

API Reference

useGoogleAuth()

React hook for Google OAuth authentication.

Returns:

{
  user: GoogleUser | null;        // Current user or null if not signed in
  loading: boolean;                 // Whether auth operation is in progress
  signIn: () => Promise<void>;      // Sign in with Google
  signOut: () => Promise<void>;     // Sign out
  getAccessToken: () => Promise<string | null>; // Get current access token
  isAuthenticated: boolean;         // Whether user is authenticated
}

Types

interface GoogleUser {
  id: string;
  email: string;
  emailVerified?: boolean;
  name?: string;
  givenName?: string;
  familyName?: string;
  photoUrl?: string;
  locale?: string;
}

interface GoogleToken {
  accessToken: string;
  refreshToken?: string;
  expiresAt?: number;
  idToken?: string;
  tokenType?: string;
  scope?: string;
}

Utilities

The package also exports utility functions for advanced use cases:

import {
  TokenManager,
  SecureStorage,
  generatePKCE,
} from '@thewoowon/google-rn';

// Token management
await TokenManager.save(token);
const token = await TokenManager.load();
await TokenManager.clear();
const isExpired = await TokenManager.isExpired();

// Secure storage
await SecureStorage.set('key', value);
const value = await SecureStorage.get('key');
await SecureStorage.remove('key');

// PKCE generation for OAuth
const { verifier, challenge } = await generatePKCE();

Platform Setup

iOS Setup

  1. Add URL scheme to your Info.plist:
<key>CFBundleURLTypes</key>
<array>
  <dict>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>com.googleusercontent.apps.YOUR_CLIENT_ID</string>
    </array>
  </dict>
</array>

Android Setup

  1. Add intent filter to your AndroidManifest.xml:
<activity
  android:name=".MainActivity"
  android:launchMode="singleTask">
  <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="com.googleusercontent.apps.YOUR_CLIENT_ID" />
  </intent-filter>
</activity>

Security Notes

  • This package uses @react-native-async-storage/async-storage for token storage, which is NOT encrypted by default
  • For production apps with sensitive data, consider using:
  • PKCE (Proof Key for Code Exchange) is implemented for enhanced security

📚 Documentation

🤝 Contributing

Contributions are welcome! Please read our Contributing Guide to get started.

📄 License

MIT © thewoowon

🙏 Acknowledgments

  • Built with React Native
  • Uses ASWebAuthenticationSession for iOS
  • Uses Chrome Custom Tabs for Android
  • Inspired by the need for a free, simple Google OAuth solution

💬 Support


Made with ❤️ by thewoowon

⭐ Star us on GitHub