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

react-native-google-one-tap

v1.0.1

Published

Native Google One Tap Sign-In for React Native Android using Android Credential Manager API

Readme

React Native Google One Tap

A React Native library for Google One Tap Sign-In on Android using the native Android Credential Manager API.

Features

  • ✅ Native Android implementation using Credential Manager API
  • ✅ TypeScript support with full type definitions
  • ✅ Simple and intuitive API
  • ✅ Follows Google's latest One Tap guidelines
  • ✅ No external dependencies beyond React Native
  • ✅ Lightweight and performant

Installation

npm install react-native-google-one-tap
# or
yarn add react-native-google-one-tap

Android Setup

1. Dependencies (Auto-Injected) ✨

Good news! Dependencies are automatically injected when you install the package. The following dependencies will be added to your android/app/build.gradle automatically:

dependencies {
    // Auto-injected by react-native-google-one-tap
    implementation 'androidx.credentials:credentials:1.3.0'
    implementation 'androidx.credentials:credentials-play-services-auth:1.3.0'
    implementation 'com.google.android.libraries.identity.googleid:googleid:1.1.0'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0'
}

Manual Setup (if auto-injection fails):

If the automatic dependency injection doesn't work, you can manually add the dependencies above to your android/app/build.gradle or run:

npx react-native-google-one-tap-setup

2. Auto-linking

The library supports React Native auto-linking. After installation, run:

cd android && ./gradlew clean && cd ..
npx react-native run-android

If auto-linking doesn't work, you can manually link by adding the package to your MainApplication.java:

import com.alexniokiz.googleonetap.GoogleOneTapPackage;

@Override
protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
        new MainReactPackage(),
        new GoogleOneTapPackage() // Add this line
    );
}

3. Google Cloud Console Setup

  1. Go to the Google Cloud Console
  2. Create a new project or select an existing one
  3. Enable the Google Identity API
  4. Create OAuth 2.0 credentials:
    • Application type: Web application
    • Name: Your app name
    • Authorized redirect URIs: https://your-domain.com/auth/callback
  5. Copy the Web client ID (not the Android client ID)

Usage

Basic Setup

import { GoogleOneTap } from 'react-native-google-one-tap';

// Configure with your web client ID from Google Cloud Console
await GoogleOneTap.configure({
  webClientId: 'your-web-client-id.apps.googleusercontent.com'
});

Sign In

import { GoogleOneTap } from 'react-native-google-one-tap';

const handleSignIn = async () => {
  try {
    const result = await GoogleOneTap.signIn();
    
    console.log('User:', result.user);
    console.log('ID Token:', result.idToken);
    
    // Use the ID token for authentication
    // Send it to your backend or use with Supabase, Firebase, etc.
  } catch (error) {
    console.error('Sign in failed:', error);
  }
};

Complete Example

import React, { useEffect, useState } from 'react';
import { View, Text, TouchableOpacity, Alert } from 'react-native';
import { GoogleOneTap, GoogleOneTapResult } from 'react-native-google-one-tap';

const App = () => {
  const [isConfigured, setIsConfigured] = useState(false);

  useEffect(() => {
    initializeGoogleOneTap();
  }, []);

  const initializeGoogleOneTap = async () => {
    try {
      if (GoogleOneTap.isAvailable()) {
        await GoogleOneTap.configure({
          webClientId: 'your-web-client-id.apps.googleusercontent.com'
        });
        setIsConfigured(true);
      }
    } catch (error) {
      console.error('Failed to configure Google One Tap:', error);
    }
  };

  const handleSignIn = async () => {
    try {
      const result: GoogleOneTapResult = await GoogleOneTap.signIn();
      
      Alert.alert(
        'Success',
        `Welcome ${result.user.name}!`
      );
      
      // Handle successful authentication
      // You can now use result.idToken for your authentication flow
      
    } catch (error) {
      Alert.alert('Error', 'Sign in failed');
    }
  };

  return (
    <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
      <Text>Google One Tap Demo</Text>
      
      {GoogleOneTap.isAvailable() && isConfigured ? (
        <TouchableOpacity onPress={handleSignIn}>
          <Text>Sign in with Google</Text>
        </TouchableOpacity>
      ) : (
        <Text>Google One Tap not available</Text>
      )}
    </View>
  );
};

export default App;

Integration with Supabase

import { GoogleOneTap } from 'react-native-google-one-tap';
import { supabase } from './supabaseClient';

const signInWithGoogle = async () => {
  try {
    // Get Google One Tap result
    const googleResult = await GoogleOneTap.signIn();
    
    // Sign in to Supabase with the ID token
    const { data, error } = await supabase.auth.signInWithIdToken({
      provider: 'google',
      token: googleResult.idToken,
      options: {
        data: {
          first_name: googleResult.user.givenName,
          last_name: googleResult.user.familyName,
          full_name: googleResult.user.name,
          avatar_url: googleResult.user.photo,
          email: googleResult.user.email,
        }
      }
    });

    if (error) throw error;
    
    console.log('Supabase sign in successful:', data);
  } catch (error) {
    console.error('Authentication failed:', error);
  }
};

API Reference

GoogleOneTap

Methods

configure(config: GoogleOneTapConfig): Promise<void>

Configures Google One Tap with your web client ID.

Parameters:

  • config.webClientId (string): Your web client ID from Google Cloud Console

Returns: Promise that resolves when configuration is complete

signIn(): Promise<GoogleOneTapResult>

Initiates the Google One Tap sign-in flow.

Returns: Promise that resolves with user data and ID token

signOut(): Promise<void>

Signs out from Google One Tap.

Returns: Promise that resolves when sign out is complete

isAvailable(): boolean

Checks if Google One Tap is available on the current platform.

Returns: true if available, false otherwise

isConfigured(): boolean

Checks if Google One Tap has been configured.

Returns: true if configured, false otherwise

Types

GoogleOneTapConfig

interface GoogleOneTapConfig {
  webClientId: string;
}

GoogleOneTapResult

interface GoogleOneTapResult {
  user: GoogleOneTapUser;
  idToken: string;
}

GoogleOneTapUser

interface GoogleOneTapUser {
  id: string;
  email: string;
  name: string;
  givenName: string;
  familyName: string;
  photo: string;
}

Requirements

  • React Native 0.60+
  • Android API level 21+ (Android 5.0)
  • Google Play Services
  • Kotlin support

Troubleshooting

Common Issues

  1. "GoogleOneTapModule not found"

    • Make sure you've run npx react-native run-android after installation
    • Check that auto-linking is working or manually link the package
  2. "No credentials available"

    • Make sure you have a Google account signed in on your device
    • Verify your web client ID is correct
  3. Build errors

    • Make sure all required dependencies are added to android/app/build.gradle
    • Clean and rebuild: cd android && ./gradlew clean && cd .. && npx react-native run-android

Debug Logs

The library includes extensive debug logging. Check your Android logs:

adb logcat | grep GoogleOneTapModule

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

If you encounter any issues, please file an issue on GitHub.