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

@ls-stack/expo-google-auth

v0.3.0

Published

Hybrid Google authentication for Expo: native GoogleSignIn on iOS, Credential Manager on Android.

Readme

@ls-stack/expo-google-auth

Expo plugin and native module that provides Google authentication with platform-specific native integrations:

  • iOS uses GoogleSignIn directly.
  • Android uses the Android Credential Manager with the Google ID library.

The JavaScript API exposes a single signIn() method that resolves with Google tokens or null if the user cancels.

Installation

pnpm add @ls-stack/expo-google-auth

Configure Expo

Update your app.json or app.config.ts to include the config plugin and provide OAuth client IDs.

{
  "expo": {
    "plugins": [
      [
        "@ls-stack/expo-google-auth/plugin",
        {
          "iosClientId": "YOUR_IOS_CLIENT_ID.apps.googleusercontent.com",
          "androidServerClientId": "YOUR_WEB_CLIENT_ID.apps.googleusercontent.com"
        }
      ]
    ]
  }
}

Optional Properties

  • iosUrlScheme: Override the URL scheme used for callbacks. Defaults to the reversed iosClientId.

iOS Setup

  1. Ensure your app has a GoogleService-Info.plist or add GIDClientID to Info.plist.
  2. Add the reversed client ID as a URL type (the plugin will add this if you provide iosClientId).
  3. After installing the package, run pod install in your iOS directory.

The plugin patches AppDelegate to forward auth callbacks to GIDSignIn.

Android Setup

  1. Supply the androidServerClientId from your Google Cloud credentials (the Web client ID).
  2. The config plugin writes the ID into android/app/src/main/res/values/strings.xml.

No additional code changes are required.

Usage

import { signIn } from '@ls-stack/expo-google-auth';

const result = await signIn();
if (!result) {
  // user cancelled
  return;
}

console.log(result.idToken);

Returned Shape

type GoogleLoginResult = {
  idToken: string;
  accessToken?: string;
  email?: string;
  name?: string;
  picture?: string;
};

Error Handling

signIn() throws an ExpoGoogleAuthError when the native flow fails. The helper isExpoGoogleAuthError and the code property let you branch on known scenarios.

import {
  signIn,
  isExpoGoogleAuthError,
  ExpoGoogleAuthError,
} from '@ls-stack/expo-google-auth';

try {
  const result = await signIn();
  if (!result) return; // user cancelled
  // handle success
} catch (error) {
  if (isExpoGoogleAuthError(error)) {
    switch (error.code) {
      case 'PLAY_SERVICES_NOT_AVAILABLE':
        showToast('Google Play services are not available on this device.');
        return;
      case 'MISSING_CLIENT_ID':
        console.error('Check the plugin configuration in app.json/app.config.ts');
        return;
      case 'SIGN_IN_IN_PROGRESS':
        return; // already handling another sign-in flow
      default:
        showToast(error.message);
    }
  } else {
    console.error('Unexpected error during Google login', error);
  }
}

Error Codes

| Code | Meaning | | ---- | ------- | | SIGN_IN_IN_PROGRESS | The native module already has an active sign-in flow. | | NO_ACTIVITY | Android activity was unavailable (usually when the app is backgrounded). | | NO_VIEW_CONTROLLER | iOS could not find a presented view controller. | | MISSING_CLIENT_ID | OAuth client ID is missing; check plugin configuration. | | AUTHENTICATION_ERROR | GoogleSignIn returned an authentication error. | | SIGNIN_ERROR | General sign-in failure from GoogleSignIn. | | CREDENTIAL_ERROR | Credential Manager could not produce a credential. | | CREDENTIAL_SECURITY_ERROR | Credential Manager blocked the request due to security policy. | | CREDENTIAL_UNSUPPORTED | Credential Manager cannot handle the requested option on this device. | | PLAY_SERVICES_NOT_AVAILABLE | Google Play services (or the Google credential provider) is unavailable. | | UNEXPECTED_ERROR | Platform threw an unexpected error. | | UNSUPPORTED_PLATFORM | The library only runs on iOS and Android. | | UNKNOWN | Fallback when no additional detail is available. |

Development

  • Build: pnpm run build
  • Clean: pnpm run clean
  • Lint: pnpm run lint