{"id":29543969,"url":"https://github.com/darksorrow/rn-google-signin","last_synced_at":"2026-02-04T13:32:28.125Z","repository":{"id":304810069,"uuid":"1017451269","full_name":"DarkSorrow/rn-google-signin","owner":"DarkSorrow","description":"Modern React Native Google Sign-In library built for TurboModules with automatic configuration detection","archived":false,"fork":false,"pushed_at":"2025-11-23T13:25:12.000Z","size":4204,"stargazers_count":20,"open_issues_count":0,"forks_count":3,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-23T15:07:55.973Z","etag":null,"topics":["google-authentication","google-signin","react-native","react-native-google-signin","turbomodules"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@novastera-oss/rn-google-signin","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DarkSorrow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["Darksorrow"]}},"created_at":"2025-07-10T14:52:01.000Z","updated_at":"2025-11-23T13:25:02.000Z","dependencies_parsed_at":"2025-07-15T23:28:31.752Z","dependency_job_id":"3b85a576-4ca6-43a6-9da2-8c9e79e08168","html_url":"https://github.com/DarkSorrow/rn-google-signin","commit_stats":null,"previous_names":["darksorrow/rn-google-signin"],"tags_count":79,"template":false,"template_full_name":null,"purl":"pkg:github/DarkSorrow/rn-google-signin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DarkSorrow%2Frn-google-signin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DarkSorrow%2Frn-google-signin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DarkSorrow%2Frn-google-signin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DarkSorrow%2Frn-google-signin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DarkSorrow","download_url":"https://codeload.github.com/DarkSorrow/rn-google-signin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DarkSorrow%2Frn-google-signin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285981824,"owners_count":27265285,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-23T02:00:06.149Z","response_time":135,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["google-authentication","google-signin","react-native","react-native-google-signin","turbomodules"],"created_at":"2025-07-17T14:13:31.652Z","updated_at":"2026-01-20T17:53:16.490Z","avatar_url":"https://github.com/DarkSorrow.png","language":"Kotlin","funding_links":["https://github.com/sponsors/Darksorrow"],"categories":[],"sub_categories":[],"readme":"# React Native Google Sign-In\n\n[![Dependabot](https://img.shields.io/badge/dependabot-enabled-brightgreen.svg)](https://dependabot.com)\n[![Security Status](https://img.shields.io/badge/security-monitored-brightgreen.svg)](https://github.com/DarkSorrow/rn-google-signin/security)\n[![Dependencies](https://img.shields.io/badge/dependencies-up%20to%20date-brightgreen.svg)](https://github.com/DarkSorrow/rn-google-signin)\n\nA modern, high-performance React Native Google Sign-In library built exclusively for **Turbo Modules** with automatic configuration detection. Part of the **Novastera** open-source ecosystem - a modern CRM/ERP platform that combines enterprise-grade authentication with comprehensive business management tools.\n\n\u003e **⚠️ Important**: This package requires React Native **New Architecture (TurboModules)** and does **NOT** support the legacy bridge architecture.\n\n## Features\n\n- **🚀 Turbo Modules**: Built with React Native's new architecture for maximum performance\n- **🔧 Automatic Configuration**: Auto-detects client IDs from `google-services.json` and `GoogleService-Info.plist`\n- **📱 Cross-Platform**: Full support for iOS and Android with platform-optimized implementations\n- **🔒 Security First**: Built-in nonce support and secure credential management\n- **⚡ Optimized Performance**: Thread-safe operations with intelligent caching and resource management\n- **🔌 Expo Ready**: Includes Expo config plugin for seamless integration\n\n## Requirements\n\n- **React Native 0.79+** with New Architecture enabled\n- **iOS 15.1+**\n- **Android API 24+**\n- **Google Play Services** (Android)\n\n## Quick Start\n\n### Installation\n\n```bash\nnpm install @novastera-oss/rn-google-signin\n# or\nyarn add @novastera-oss/rn-google-signin\n```\n\n### Configuration\n\nConfigure the library with your Google client IDs:\n\n```typescript\nimport { GoogleSignin } from '@novastera-oss/rn-google-signin';\n\n// Manual configuration (recommended)\nawait GoogleSignin.configure({\n  webClientId: 'your-web-client-id.apps.googleusercontent.com',\n  androidClientId: 'your-android-client-id.apps.googleusercontent.com',\n  iosClientId: 'your-ios-client-id.apps.googleusercontent.com',\n});\n\n// Automatic detection (fallback only)\nawait GoogleSignin.configure({});\n```\n\n### Basic Usage\n\n```typescript\n// Sign in\ntry {\n  const userInfo = await GoogleSignin.signIn({});\n  console.log('User info:', userInfo);\n} catch (error) {\n  console.error('Sign in error:', error);\n}\n\n// Sign out\nawait GoogleSignin.signOut();\n```\n\n**⚠️ Important**: Due to React Native TurboModule requirements, all method parameters must be explicitly passed, even when using default values.\n\n```typescript\n// ✅ Correct - always pass the parameter\nawait GoogleSignin.signIn({});\nawait GoogleSignin.hasPlayServices({});\n\n// ❌ Incorrect - will cause runtime errors\nawait GoogleSignin.signIn();\nawait GoogleSignin.hasPlayServices();\n```\n\n**Note**: When using default configuration, pass `{}` as the parameter. When using custom options, pass an object with the desired configuration.\n\n## Configuration\n\n### Manual Configuration (Recommended)\n\nProvide your Google client IDs explicitly:\n\n```typescript\nawait GoogleSignin.configure({\n  // Android (choose one)\n  androidClientId: 'your-android-client-id.apps.googleusercontent.com',\n  webClientId: 'your-web-client-id.apps.googleusercontent.com',\n  \n  // iOS\n  iosClientId: 'your-ios-client-id.apps.googleusercontent.com',\n});\n```\n\n### Automatic Detection (Fallback)\n\nThe library can automatically detect client IDs from configuration files as a fallback:\n\n**Android:**\n- `google-services.json` in `android/app/` directory\n- Uses Google Services plugin to generate `R.string.default_web_client_id`\n\n**iOS:**\n- `GoogleService-Info.plist` in your iOS project\n- Extracts `CLIENT_ID` from the plist file\n\n**Note**: Automatic detection is provided as a convenience fallback. For production apps, explicit configuration is recommended for better control and reliability.\n\n## Expo Configuration\n\n### Automatic Mode (Default)\n\nAdd the plugin without options to your `app.json` or `app.config.js`:\n\n```json\n{\n  \"expo\": {\n    \"plugins\": [\n      \"@novastera-oss/rn-google-signin\"\n    ]\n  }\n}\n```\n\n**Requirements for Automatic Mode:**\n- Place `google-services.json` in your **project root** (same level as `app.json`)\n- Place `GoogleService-Info.plist` in your **project root** (same level as `app.json`)\n- Reference them in your `app.json` configuration:\n\n```json\n{\n  \"expo\": {\n    \"ios\": {\n      \"googleServicesFile\": \"./GoogleService-Info.plist\"\n    },\n    \"android\": {\n      \"googleServicesFile\": \"./google-services.json\"\n    }\n    \"plugins\": [\n      [\n        \"@novastera-oss/rn-google-signin\",\n      ]\n    ]\n  }\n}\n```\n\n### Manual Mode\n\nAdd the plugin with options to your `app.json` or `app.config.js`:\n\n```json\n{\n  \"expo\": {\n    \"plugins\": [\n      [\n        \"@novastera-oss/rn-google-signin\",\n        {\n          \"iosUrlScheme\": \"com.googleusercontent.apps.your-ios-client-id\"\n        }\n      ]\n    ]\n  }\n}\n```\n\n**Requirements for Manual Mode:**\n- The plugin only adds URL schemes, no file handling\n- If you don't provide client IDs in your configuration, you must manually add `GoogleService-Info.plist` to your iOS project\n\n**Complete Manual Configuration Example:**\n\n```json\n{\n  \"expo\": {\n    \"ios\": {\n      \"bundleIdentifier\": \"com.yourcompany.yourapp\",\n      \"supportsTablet\": true,\n      \"infoPlist\": {\n        \"CFBundleURLTypes\": [\n          {\n            \"CFBundleURLSchemes\": [\n              \"com.googleusercontent.apps.your-ios-client-id\"\n            ]\n          },\n          {\n            \"CFBundleURLSchemes\": [\n              \"com.yourcompany.yourapp\"\n            ]\n          }\n        ],\n        \"GIDClientID\": \"your-ios-client-id.apps.googleusercontent.com\",\n        \"UIBackgroundModes\": [\"fetch\", \"remote-notification\"]\n      },\n      \"entitlements\": {\n        \"aps-environment\": \"development\"\n      }\n    }\n  }\n}\n```\n\n**Note**: Replace `your-ios-client-id` with your actual iOS client ID from Google Cloud Console.\n\n## Platform-Specific Features\n\n### iOS\n- **Full Scope Support**: Add additional scopes after sign-in\n- **Complete Token Management**: Access to both access and ID tokens\n- **Rich User Profile**: Complete user information including photos\n\n### Android\n- **Modern Credential Manager**: Uses Google's latest Credential Manager API\n- **Optimized Performance**: Thread-safe operations with intelligent caching\n- **Basic Authentication**: Focused on core sign-in functionality\n- **⚠️ Important**: `isSignedIn()` may trigger the credential picker UI even when the user is already signed in. This is a limitation of Google's Credential Manager API. Consider implementing your own sign-in state management for better user experience.\n\n### Platform Differences\n\n| Feature | iOS | Android | Notes |\n|---------|-----|---------|-------|\n| Basic Sign-In | ✅ | ✅ | |\n| Sign Out | ✅ | ✅ | |\n| Get Current User | ✅ | ✅ | |\n| isSignedIn | ✅ | ⚠️ | Android: may trigger credential picker UI |\n| Add Scopes | ✅ | ❌ | Android: Credential Manager limitation |\n| Access Token | ✅ | ⚠️ | Android: same as ID token |\n| Custom Scopes | ✅ | ❌ | Android: not supported |\n\n## Performance Optimizations\n\nThis library includes several performance optimizations:\n\n### Thread Safety\n- **Atomic Operations**: Uses `AtomicReference` for thread-safe promise management\n- **Single Executor**: Consistent threading model with dedicated executor\n- **Weak References**: Prevents memory leaks with proper lifecycle management\n\n### Resource Management\n- **Credential Manager Caching**: Avoids recreation on every operation by caching with activity matching\n- **Activity Validation**: Smart activity state checking with early returns\n- **Promise Deduplication**: Prevents concurrent operations by cancelling previous promises\n\n### Configuration Management\n- **Manual Configuration Priority**: Explicit client IDs take precedence over automatic detection\n- **Automatic Detection Fallback**: Graceful fallback to config files when manual config not provided\n- **Multiple Resource Names**: Tries various resource names for compatibility\n- **Graceful Fallback**: Never crashes, always falls back gracefully\n\n## API Reference\n\n### Configuration\n\n```typescript\ninterface ConfigureParams {\n  webClientId?: string;        // Web client ID\n  androidClientId?: string;    // Android client ID\n  iosClientId?: string;        // iOS client ID\n  scopes?: string[];          // Initial scopes (iOS only)\n}\n```\n\n### User Object\n\n```typescript\ninterface User {\n  id: string;\n  name: string;\n  email: string;\n  photo?: string;\n  familyName?: string;\n  givenName?: string;\n}\n```\n\n### Sign In Response\n\n```typescript\ninterface SignInResponse {\n  user: User;\n  scopes: string[];\n  serverAuthCode?: string;\n  idToken?: string;\n}\n```\n\n## Error Handling\n\n```typescript\ntry {\n  await GoogleSignin.signIn({});\n} catch (error: any) {\n  switch (error.code) {\n    case 'sign_in_cancelled':\n      // User cancelled\n      break;\n    case 'sign_in_required':\n      // Sign in required\n      break;\n    case 'not_configured':\n      // Not configured\n      break;\n    case 'network_error':\n      // Network error\n      break;\n    default:\n      console.error('Sign in error:', error);\n  }\n}\n```\n\n## Troubleshooting\n\n### Common Issues\n\n1. **\"No client ID found\"**: Ensure configuration files are in the correct location\n2. **\"No activity available\"**: Make sure the app is in the foreground\n3. **\"TurboModule not found\"**: Ensure New Architecture is enabled\n\n### Enable New Architecture\n\n```bash\n# iOS\ncd ios \u0026\u0026 RCT_NEW_ARCH_ENABLED=1 bundle exec pod install\n\n# Android - Add to android/gradle.properties\nnewArchEnabled=true\n```\n\n### Android Setup\n\n1. Place `google-services.json` in `android/app/`\n2. Ensure Google Play Services is installed\n3. Add a Google account in device settings\n\n### iOS Setup\n\n1. Add `GoogleService-Info.plist` to your iOS project\n2. Ensure bundle identifier matches Google Cloud Console\n3. Enable Google Sign-In capability\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests if applicable\n5. Submit a pull request\n\n## FAQ\n\n### Q: Google Sign-In popup doesn't show in APK builds but works in development\n\n**A:** This is a common issue with production APK builds. Add these permissions to your app's `android/app/src/main/AndroidManifest.xml`:\n\n```xml\n\u003cmanifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\u003e\n    \u003cuses-permission android:name=\"android.permission.INTERNET\" /\u003e\n    \u003cuses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" /\u003e\n    \n    \u003capplication\u003e\n        \u003c!-- Your app configuration --\u003e\n    \u003c/application\u003e\n\u003c/manifest\u003e\n```\n\nAlso ensure your package name in `android/app/build.gradle` matches your Google Cloud Console configuration and add your production SHA-1 fingerprint:\n\n```bash\ncd android \u0026\u0026 ./gradlew signingReport\n```\n\n**Note:** For apps already published on Google Play Store, you can also find the SHA-1 fingerprint in the Play Console under **Release \u003e Setup \u003e App integrity**.\n\n### Q: Why does `isSignedIn()` trigger the credential picker on Android?\n\n**A:** This is a limitation of Google's Credential Manager API. Consider implementing your own sign-in state management for better user experience.\n\n### Q: Why doesn't the library include a UI button, secure storage, or token parsing?\n\n**A:** The library focuses on providing the core Google Sign-In functionality while keeping things simple. Here's the reasoning behind these design decisions:\n\n**No UI Button:**\n- UI components would need customization to match different app designs\n- Most apps already have their own design systems and UI components\n- Keeps the package focused on authentication logic\n\n**Built-in Secure Storage:**\n- **iOS**: Google Sign-In SDK uses Keychain Services for secure token storage\n- **Android**: Credential Manager uses Encrypted SharedPreferences with AES-256 encryption\n- Both platforms have built-in token management with secure storage\n- No need for additional storage libraries for basic token management\n- You can still use additional storage libraries if you need custom features\n\n**No Token Parsing:**\n- JavaScript has built-in functions to parse JSON efficiently\n- Different applications handle tokens differently based on their needs\n- Would add another dependency and create parsing you might re-parse anyway\n- Keeps the package lightweight\n\nThis approach aims to keep dependencies minimal while providing the raw data you need to implement your app's specific requirements.\n\n### Q: Why is the iOS implementation in Objective-C instead of Swift?\n\n**A:** TurboModules don't support Swift natively yet. Using Swift would require the code to be bridged to Objective-C, which adds unnecessary overhead and complexity. Objective-C provides direct compatibility with TurboModules without any bridging layer, resulting in better performance and simpler integration.\n\n## About Novastera\n\n**React Native Google Sign-In** is part of the **Novastera** open-source ecosystem, a modern CRM/ERP platform designed for the next generation of business applications. Novastera combines cutting-edge authentication solutions with comprehensive business management tools, enabling organizations to leverage modern social login for seamless user experiences and enhanced security.\n\n### Key Features of Novastera Platform\n\n- **Modern CRM/ERP System**: Comprehensive business management with AI-powered insights and real-time collaboration\n- **Secure Authentication**: Enterprise-grade authentication with Google Sign-In, OAuth 2.0, and social login support\n- **Mobile-First**: Native iOS and Android applications built with React Native and Turbo Modules\n- **Open Source**: Part of Novastera's commitment to open-source innovation and developer-friendly solutions\n- **Privacy-Focused**: On-device AI capabilities with no data leaving user devices\n\nThis library is currently being used in [Novastera's](https://novastera.com) mobile application, demonstrating its capabilities in production environments. We're committed to providing modern, secure authentication solutions that stay up-to-date with the latest Google Sign-In SDK features and React Native best practices, helping developers build applications with seamless social login experiences.\n\nLearn more about Novastera: [https://novastera.com/resources](https://novastera.com/resources)\n\n## License\n\nApache License - see [LICENSE](LICENSE) file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarksorrow%2Frn-google-signin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarksorrow%2Frn-google-signin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarksorrow%2Frn-google-signin/lists"}