Open
Conversation
- Introduced a new package that provides a Google Sign-In adapter for both web and React Native. - Implemented native modules for iOS and Android to handle Google Sign-In functionality. - Added configuration options for client IDs and token management. - Included a component for easy integration in applications. - Updated and to include the new package and its dependencies. This addition enhances the authentication capabilities of the library.
…ions - Added support for requesting server auth code in the Android implementation to facilitate scoped access tokens. - Updated iOS implementation to handle additional OAuth scopes during sign-in. - Introduced nonce parameter in web configuration to enhance security against replay attacks. - Removed storage requirement check from the native GoogleAuthClient constructor to simplify initialization.
…tation improvements - Added '@vitejs/plugin-react' and 'vite' as dependencies in the package.json for better integration. - Updated README to clarify the loading of Google Identity Services with a timeout and emphasized the required 'storage' field in TypeScript for React Native. - Introduced a nonce parameter in the GoogleSignInButton component to enhance security against replay attacks.
- Refactored ID token retrieval to use guard statements, enhancing error handling by rejecting promises when no ID token is returned. - Updated GoogleSignInButton to configure the module before signing in, ensuring proper initialization.
c86ed9c to
e45dd58
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces a new @forward-software/react-auth-google package to provide an official Google Sign-In AuthClient adapter and drop-in sign-in button for both Web (Google Identity Services) and React Native (Expo Modules + native iOS/Android implementations).
Changes:
- Added a new
packages/google-signinpackage with web + nativeGoogleAuthClient,GoogleSignInButton, and shared types. - Added Expo native modules for iOS (Swift + CocoaPods) and Android (Kotlin + Credential Manager) to perform Google Sign-In.
- Added Vitest unit tests and updated the pnpm workspace to include
packages/*.
Reviewed changes
Copilot reviewed 25 out of 26 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-workspace.yaml | Expands workspace globs to include packages/* so the new package is picked up. |
| packages/google-signin/vitest.config.ts | Adds Vitest config for the new package. |
| packages/google-signin/tsconfig.json | Adds TS build configuration for the new package. |
| packages/google-signin/test/test-utils.ts | Adds mock storage + JWT helpers for tests. |
| packages/google-signin/test/GoogleAuthClient.web.spec.ts | Adds unit tests for web GoogleAuthClient. |
| packages/google-signin/test/GoogleAuthClient.native.spec.ts | Adds unit tests for native GoogleAuthClient with mocked Expo native module. |
| packages/google-signin/src/types.ts | Defines cross-platform public types/configuration. |
| packages/google-signin/src/web/index.ts | Web entry re-exports. |
| packages/google-signin/src/web/gsi.ts | Web GSI script loader + typed wrapper helpers. |
| packages/google-signin/src/web/GoogleSignInButton.tsx | Web sign-in button component based on GSI. |
| packages/google-signin/src/web/GoogleAuthClient.ts | Web AuthClient implementation with storage persistence. |
| packages/google-signin/src/native/index.ts | Native entry re-exports (including module namespace). |
| packages/google-signin/src/native/GoogleSignInModule.ts | JS wrapper around the Expo native module. |
| packages/google-signin/src/native/GoogleSignInButton.tsx | React Native sign-in button that triggers native sign-in. |
| packages/google-signin/src/native/GoogleAuthClient.ts | Native AuthClient implementation with refresh support. |
| packages/google-signin/src/index.ts | Default (web) package root entry. |
| packages/google-signin/src/index.native.ts | React Native package root entry. |
| packages/google-signin/package.json | Defines package metadata, build/test scripts, and conditional exports. |
| packages/google-signin/react-auth-google.podspec | CocoaPods spec for iOS integration (package root). |
| packages/google-signin/ios/react-auth-google.podspec | CocoaPods spec colocated under ios/. |
| packages/google-signin/ios/GoogleSignInModule.swift | iOS Expo module implementation using GoogleSignIn. |
| packages/google-signin/expo-module.config.json | Expo module registration for iOS/Android. |
| packages/google-signin/android/build.gradle | Android library build config + dependencies. |
| packages/google-signin/android/src/main/java/expo/modules/googlesignin/GoogleSignInModule.kt | Android Expo module implementation using Credential Manager + Google Identity. |
| packages/google-signin/README.md | Package documentation and usage examples. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/google-signin/android/src/main/java/expo/modules/googlesignin/GoogleSignInModule.kt
Show resolved
Hide resolved
- Added support for web GSI in package.json, allowing for better integration with web applications. - Refactored ID token expiration extraction in both web and native clients to use a dedicated base64 URL decode method for improved readability and maintainability. - Updated GoogleSignInButton to use a more specific type for the style prop, enhancing type safety. - Improved error handling in the loadGsiScript function to manage script loading timeouts and errors more effectively.
- Introduced a new 'label' prop to the GoogleSignInButton, allowing users to customize the button text. - Default label set to 'Sign in with Google' for improved user experience.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue(s)
N/A
Motivation
The
@forward-software/react-authlibrary currently lacks built-in support for Google Sign-In. Users who want Google authentication need to manually wire up their own adapter, handling platform differences between web and React Native themselves. This PR adds an official Google Sign-In package that works out of the box on both platforms.Description of Changes
@forward-software/react-auth-googlepackage underpackages/google-signin/that provides a Google Sign-In AuthClient adapter for both web and React Nativepnpm-workspace.yamlandpnpm-lock.yamlto include the new packageHow to Test
-- Run pnpm install (or equivalent).
-- Run the development server (pnpm dev or equivalent) for the library or examples to ensure Vite starts correctly.
-- Run a build (pnpm build or equivalent) to ensure it completes successfully.
Checklist
Notes for Reviewers
index.tsfor web,index.native.tsfor React Native) resolved automatically by the bundler.expo-modules-coreandreact-nativeare optional peer dependencies, allowing the package to be used in web-only projects without pulling in native dependencies.