Registry / auth-security / expo-google-auth

expo-google-auth

JSON →
library0.3.0jsnpmunverified

The `expo-google-auth` package, currently at version 0.3.0, offers a dedicated solution for integrating Google authentication into React Native Expo applications. It achieves this by leveraging Google's modern Identity API and Credential Manager, presenting an updated approach to handling user sign-ins compared to traditional methods. While it provides two primary authentication methods, the module explicitly recommends "Method 1" as the latest approach endorsed by Google. A crucial aspect of this library is its current platform limitation: it exclusively supports Android environments. Developers targeting iOS are directed to use `expo-auth-session` for their authentication needs. Launched publicly in November 2025, the package has seen a consistent, albeit minor, release cadence, signaling ongoing development. To function correctly, users must perform essential Google Credentials setup for both Android and web clients, which includes obtaining and configuring a Google Web Client ID. This package aims to simplify Google sign-in workflows specifically for Android within the Expo ecosystem.

npm install expo-google-auth
INSTALL
IMPORT
SIG · EXPO-GOOGLE-AUTH
E
expo-google-auth
auth-securityjavascriptv0.3.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ExpoGoogleAuth
✓ import ExpoGoogleAuth from 'expo-google-auth';
✗ const ExpoGoogleAuth = require('expo-google-auth');
Primarily designed for ESM usage within Expo/React Native projects. CommonJS `require` is not officially supported and may lead to issues.

Demonstrates how to initiate Google authentication using the recommended 'GID' method and handle the returned ID token. Includes error handling and prompts for necessary configuration.

import ExpoGoogleAuth from 'expo-google-auth'; import { Alert } from 'react-native'; // For showing results in a real app const MY_GOOGLE_WEB_CLIENT_ID = process.env.GOOGLE_WEB_CLIENT_ID ?? 'YOUR_GWC_ID_HERE'; // Replace with your actual GWC ID async function signInWithGoogle() { if (MY_GOOGLE_WEB_CLIENT_ID === 'YOUR_GWC_ID_HERE') { Alert.alert('Configuration Error', 'Please replace YOUR_GWC_ID_HERE with your actual Google Web Client ID.'); return; } try { // Method 1: Latest, Recommended by Google const idToken = await ExpoGoogleAuth.launchGoogleAuth("GID", MY_GOOGLE_WEB_CLIENT_ID); if (idToken) { Alert.alert('Sign-in Successful', `Received ID Token: ${idToken.substring(0, 30)}...`); console.log('Google ID Token:', idToken); // Now, provide this id token to your backend auth provider } else { Alert.alert('Sign-in Failed', 'No ID token received.'); } } catch (error) { console.error('Google Sign-in Error:', error); Alert.alert('Sign-in Error', error.message || 'An unknown error occurred during Google sign-in.'); } } // Example of how to call it (e.g., from a button press in a React Native component) signInWithGoogle();
Debug
Known issues
gotchaThis module currently provides native Google authentication support exclusively for Android. For iOS applications, developers are explicitly advised to use `expo-auth-session`.
fix
For iOS, implement Google authentication using `expo-auth-session` as recommended in the official Expo documentation.
affects: >=0.1.1
gotchaSuccessful Google authentication requires proper setup of Google Credentials, including obtaining a Google Web Client ID (GWC ID) and configuring it in the Google Cloud Console for your Android application (and potentially web client).
fix
Refer to Google's Identity API documentation and Expo's guides for setting up Google Credentials, ensuring your GWC ID and Android SHA-1 fingerprints are correctly configured.
affects: >=0.1.1
gotchaThe `launchGoogleAuth` method accepts two string arguments: 'GID' (recommended) or 'SWIG' (traditional). While both may work, Google's latest recommendations favor the 'GID' approach.
fix
Always prefer `ExpoGoogleAuth.launchGoogleAuth("GID", gwcId)` for the most current and recommended Google Identity API integration.
affects: >=0.1.1
Errors
Common errors & fixes
Failed to authenticate. ID token is null or undefined.
Google credentials (e.g., Google Web Client ID, SHA-1 fingerprints for Android) are incorrectly configured or missing in the Google Cloud Console.
fix
Verify that your Google Web Client ID is correct, the Android client is registered with the correct package name and SHA-1 fingerprint in the Google Cloud Console, and ensure the API is enabled.
TypeError: ExpoGoogleAuth.launchGoogleAuth is not a function
This error typically occurs when attempting to use CommonJS `require()` syntax with an ESM-only package, or when TypeScript/Babel transpilation is misconfigured.
fix
Ensure you are using `import ExpoGoogleAuth from 'expo-google-auth';` in your JavaScript/TypeScript files. If using CommonJS, consider project-wide migration to ESM or using dynamic import.
Module not found: Can't resolve 'expo-google-auth'
The package `expo-google-auth` has not been installed, or there's a typo in the import path.
fix
Run `npm install expo-google-auth` or `yarn add expo-google-auth` in your project directory. Double-check the spelling of the import path.
Upgrade
Version history
0.3.0latest on npm
Audit
Dependencies
exporequiredCore Expo framework dependency.
reactrequiredCore React library for UI development.
react-nativerequiredCore React Native library for mobile app development.
Agent activity
24 hits · last 30 days
node
20
Amazon
1
OpenAI (training)
1
Resources
expo-google-auth — npm install expo-google-auth · libregistry