Skip to content

Conversation

@chriscanin
Copy link
Member

Description

This PR implements native Google Sign-In support for Expo iOS and Android apps using the @react-native-google-signin/google-signin library. This provides a seamless native authentication experience for users signing in with their Google accounts.

What's New

  • New Hook: useSignInWithGoogle() - Provides native Google Sign-In functionality for iOS and Android
    • Platform-specific implementations for iOS (useSignInWithGoogle.ios.ts) and Android (useSignInWithGoogle.android.ts)
    • Automatic handling of sign-in/sign-up transfer flow
    • Graceful error handling including user cancellation detection
    • Support for custom unsafeMetadata during authentication

Key Features

  • Native UI: Uses platform-native Google Sign-In UI instead of web-based OAuth flow
  • Automatic Flow Detection: Seamlessly handles both new user sign-up and existing user sign-in
  • Error Handling: Comprehensive error handling for:
    • Missing credentials
    • User cancellation (codes SIGN_IN_CANCELLED and -5)
    • Play Services availability (Android)
  • Environment Variable Support: Reads credentials from both Expo config and environment variables
  • Full Test Coverage: Complete unit tests with 100% coverage for the new hook

Files Changed

  • packages/expo/src/hooks/useSignInWithGoogle.ts - Cross-platform stub with helpful error message
  • packages/expo/src/hooks/useSignInWithGoogle.ios.ts - iOS-specific implementation
  • packages/expo/src/hooks/useSignInWithGoogle.android.ts - Android-specific implementation
  • packages/expo/src/hooks/__tests__/useSignInWithGoogle.test.ts - Comprehensive unit tests
  • packages/expo/src/hooks/index.ts - Export new hook
  • packages/expo/package.json - Add optional peer dependency
  • packages/expo/vitest.setup.mts - Add test mocks for expo-modules-core

Implementation Details

iOS Implementation:

  • Uses expo-apple-authentication for native Sign-In
  • Supports oauth_token_apple strategy
  • Handles identity token exchange

Android Implementation:

  • Uses @react-native-google-signin/google-signin library
  • Configures with Web Client ID and Android Client ID
  • Checks Google Play Services availability
  • Handles google_one_tap strategy with ID token

Both implementations:

  • Automatically handle transfer flow when user doesn't exist
  • Return consistent API: { createdSessionId, setActive, signIn, signUp }
  • Support optional unsafeMetadata parameter

Breaking Changes

None - this is a new feature.

Test Plan

  1. Unit tests pass (pnpm test --filter @clerk/clerk-expo)
  2. Build succeeds (pnpm build)
  3. All 9 test cases pass including:
    • Successful sign-in for existing users
    • Transfer flow for new users
    • User cancellation handling (both error codes)
    • Play Services availability check (Android)
    • Missing ID token validation
    • Missing credentials validation
    • Clerk not loaded handling

Documentation

Related documentation PR: [Link to clerk-docs PR]

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • JSDoc comments have been added for the new hook and all exported functions
  • Documentation has been created (see related PR in clerk-docs)

Type of change

  • 🌟 New feature

Summary by CodeRabbit

  • New Features

    • Native Google One Tap Sign-In for iOS and Android: configure, sign-in, create account, explicit sign-in, sign-out; iOS plugin can auto-configure URL scheme.
    • Cross-platform useSignInWithGoogle hook with shared flow and platform-specific adapters; JS helpers and public types for One Tap integration.
  • Tests

    • Unit tests covering Android sign-in hook flows and edge cases.
  • Chores

    • Packaging, build and module metadata updates; CocoaPods and Android build config added; .gitignore updated.

✏️ Tip: You can customize this high-level summary in your review settings.

@chriscanin chriscanin requested a review from dstaley January 5, 2026 22:40
@changeset-bot
Copy link

changeset-bot bot commented Jan 5, 2026

🦋 Changeset detected

Latest commit: 668b41b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clerk/clerk-expo Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jan 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Jan 9, 2026 7:59pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 5, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chriscanin
Copy link
Member Author

!snapshot

@chriscanin chriscanin changed the title feat(expo): Implement Google Sign-In support for Android and iOS (#7208) feat(clerk-expo): Implement Google Sign-In support for Android and iOS (#7208) Jan 5, 2026
@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 5, 2026

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@7538

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@7538

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@7538

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@7538

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@7538

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@7538

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@7538

@clerk/clerk-expo

npm i https://pkg.pr.new/@clerk/clerk-expo@7538

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@7538

@clerk/express

npm i https://pkg.pr.new/@clerk/express@7538

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@7538

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@7538

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@7538

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@7538

@clerk/clerk-react

npm i https://pkg.pr.new/@clerk/clerk-react@7538

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@7538

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@7538

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@7538

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@7538

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@7538

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@7538

@clerk/types

npm i https://pkg.pr.new/@clerk/types@7538

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@7538

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@7538

commit: 668b41b

@chriscanin
Copy link
Member Author

!snapshot

1 similar comment
@chriscanin
Copy link
Member Author

!snapshot

@clerk-cookie
Copy link
Collaborator

Hey @chriscanin - the snapshot version command generated the following package versions:

Package Version
@clerk/chrome-extension 2.8.15-snapshot.v20260106160943
@clerk/clerk-js 5.117.1-snapshot.v20260106160943
@clerk/clerk-expo 2.20.0-snapshot.v20260106160943

Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/chrome-extension

npm i @clerk/[email protected] --save-exact

@clerk/clerk-js

npm i @clerk/[email protected] --save-exact

@clerk/clerk-expo

npm i @clerk/[email protected] --save-exact

@chriscanin
Copy link
Member Author

!snapshot

@clerk-cookie
Copy link
Collaborator

Hey @chriscanin - the snapshot version command generated the following package versions:

Package Version
@clerk/clerk-expo 2.20.0-snapshot.v20260108220629

Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/clerk-expo

npm i @clerk/[email protected] --save-exact

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants