{"id":41730095,"url":"https://github.com/sbaiahmed1/react-native-google-auth","last_synced_at":"2026-01-24T23:28:54.243Z","repository":{"id":312353478,"uuid":"1044143588","full_name":"sbaiahmed1/react-native-google-auth","owner":"sbaiahmed1","description":"Modern React Native Google Authentication library with TypeScript support, token management, and cross-platform compatibility for iOS and Android (SWG Credential manager).","archived":false,"fork":false,"pushed_at":"2026-01-13T22:08:57.000Z","size":1719,"stargazers_count":133,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-13T23:59:26.406Z","etag":null,"topics":["google-authentication","google-sign-in","react-native","react-native-google-signin"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/react-native-google-auth","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sbaiahmed1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"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}},"created_at":"2025-08-25T08:49:57.000Z","updated_at":"2026-01-13T22:09:01.000Z","dependencies_parsed_at":"2025-08-30T03:16:19.203Z","dependency_job_id":"d999af29-886c-4ce5-89e4-f5e6677729fd","html_url":"https://github.com/sbaiahmed1/react-native-google-auth","commit_stats":null,"previous_names":["sbaiahmed1/react-native-google-auth"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/sbaiahmed1/react-native-google-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbaiahmed1%2Freact-native-google-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbaiahmed1%2Freact-native-google-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbaiahmed1%2Freact-native-google-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbaiahmed1%2Freact-native-google-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sbaiahmed1","download_url":"https://codeload.github.com/sbaiahmed1/react-native-google-auth/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbaiahmed1%2Freact-native-google-auth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28738991,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T22:12:27.248Z","status":"ssl_error","status_checked_at":"2026-01-24T22:12:10.529Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-sign-in","react-native","react-native-google-signin"],"created_at":"2026-01-24T23:28:26.328Z","updated_at":"2026-01-24T23:28:50.324Z","avatar_url":"https://github.com/sbaiahmed1.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Native Google Authentication Library | Modern Google Sign-In SDK\n\n[![npm version](https://badge.fury.io/js/react-native-google-auth.svg)](https://badge.fury.io/js/react-native-google-auth)\n[![npm downloads](https://img.shields.io/npm/d18m/react-native-google-auth.svg)](https://img.shields.io/npm/d18m/react-native-google-auth.svg)\n[![GitHub stars](https://img.shields.io/github/stars/sbaiahmed1/react-native-google-auth.svg)](https://github.com/sbaiahmed1/react-native-google-auth/stargazers)\n\n**react-native-google-auth** is a comprehensive React Native Google Authentication library that provides seamless Google Sign-In integration for iOS and Android applications. Built with modern APIs including Google Sign-In SDK for iOS and Android Credential Manager, this library offers the most up-to-date Google authentication solution for React Native developers.\n\n## 📋 Table of Contents\n\n- [Why Choose react-native-google-auth?](#why-choose-react-native-google-auth)\n- [Key Features \u0026 Benefits](#key-features--benefits)\n- [Installation](#installation)\n- [🚀 Quick Start](#-quick-start)\n- [📱 Platform Setup](#-platform-setup)\n  - [Expo Setup (Recommended)](#expo-setup-recommended)\n  - [React Native CLI Setup](#react-native-cli-setup)\n- [🔧 Google Cloud Console Setup](#-google-cloud-console-setup)\n- [💻 Usage](#-usage)\n- [🔍 API Reference](#-api-reference)\n- [🐛 Troubleshooting](#-troubleshooting)\n- [📚 Examples](#-examples)\n\n## Why Choose react-native-google-auth?\n\nThis React Native Google Sign-In library stands out from other Google authentication solutions by leveraging the latest Google APIs and providing a unified, type-safe interface for both iOS and Android platforms. Perfect for developers looking to implement Google OAuth, Google Login, or Google SSO in their React Native mobile applications.\n\n## Key Features \u0026 Benefits\n\n### 🚀 Modern Google Authentication APIs\n- ✅ **Latest Google Sign-In SDK**: Uses Google Sign-In SDK for iOS and Android Credential Manager (not deprecated GoogleSignIn)\n- ✅ **Google One Tap Sign-In**: Seamless authentication experience with saved credentials\n- ✅ **OAuth 2.0 Compliant**: Full OAuth 2.0 and OpenID Connect support\n- ✅ **Token Management**: Automatic token refresh and expiration handling\n\n### 💻 Developer Experience\n- ✅ **Full TypeScript Support**: Complete TypeScript definitions and IntelliSense\n- ✅ **Cross-Platform Compatibility**: Works seamlessly on both iOS and Android\n- ✅ **Expo Config Plugin**: Zero-configuration setup for Expo projects\n- ✅ **Comprehensive Documentation**: Detailed guides and API reference\n\n### 🔒 Security \u0026 Reliability\n- ✅ **Secure Token Storage**: Secure credential storage using platform keychain\n- ✅ **Error Handling**: Comprehensive error codes and user-friendly messages\n- ✅ **Production Ready**: Battle-tested authentication flows\n- ✅ **Google Play Services**: Automatic Google Play Services availability checking\n\n### 🎯 Use Cases\n- **React Native Google Login**: Implement Google sign-in in React Native apps\n- **Mobile OAuth Authentication**: Secure user authentication for mobile apps\n- **Social Login Integration**: Add Google as a social login provider\n- **Enterprise SSO**: Single Sign-On for enterprise applications\n- **User Profile Management**: Access Google user profile information\n\n## Installation\n\nInstall the React Native Google Authentication library using your preferred package manager:\n\n```bash\n# Using Yarn (Recommended)\nyarn add react-native-google-auth\n\n# Using NPM\nnpm install react-native-google-auth\n\n# Using pnpm\npnpm add react-native-google-auth\n\n# For Expo projects\nnpx expo install react-native-google-auth\n```\n\n## 🚀 Quick Start\n\nGet started with Google Sign-In in your React Native app in just 3 steps:\n\n1. **Install the package** (see above)\n2. **Configure your Google OAuth credentials** (see setup guides below)\n3. **Initialize and use** the authentication methods\n\n```typescript\nimport { GoogleAuth, GoogleAuthScopes } from 'react-native-google-auth';\n\n// Configure once in your app\nawait GoogleAuth.configure({\n  iosClientId: 'YOUR_IOS_CLIENT_ID.apps.googleusercontent.com',\n  androidClientId: 'YOUR_WEB_CLIENT_ID.apps.googleusercontent.com', // Use Web OAuth client ID for Android\n  scopes: [GoogleAuthScopes.EMAIL, GoogleAuthScopes.PROFILE]\n});\n\n// Sign in users\nconst response = await GoogleAuth.signIn();\nif (response.type === 'success') {\n  console.log('User signed in:', response.data.user);\n}\n```\n\n\u003e **Android Note:** The `androidClientId` must be a **Web application OAuth client ID** (not Android OAuth client), as required by the Android Credential Manager API.\n\n## 📱 Platform Setup\n\n### Expo Setup (Recommended)\n\n\u003e **⚠️ Important**: This library requires native code and is **not compatible with Expo Go**. You must use **Expo Development Build** or eject to a bare React Native project.\n\n#### Prerequisites\n\n- Expo SDK 49+ (recommended)\n- Expo Development Build configured\n- EAS CLI installed: `npm install -g @expo/eas-cli` or local dev server\n\n#### Step 1: Install the Package\n\n```bash\nnpx expo install react-native-google-auth\n```\n\n#### Step 2: Configure the Expo Plugin\n\nAdd the plugin to your `app.json` or `app.config.js`:\n\n```json\n{\n  \"expo\": {\n    \"name\": \"Your App Name\",\n    \"plugins\": [\n      [\n        \"react-native-google-auth\",\n        {\n          \"iosClientId\": \"YOUR_IOS_CLIENT_ID.apps.googleusercontent.com\",\n          \"androidClientId\": \"YOUR_ANDROID_CLIENT_ID.apps.googleusercontent.com\"\n        }\n      ]\n    ]\n  }\n}\n```\n\n**Alternative: Automatic Configuration (Recommended)**\n\nPlace your Google configuration files in your project root and let the plugin auto-detect them:\n\n1. Download `GoogleService-Info.plist` from Firebase Console (iOS)\n2. Download `google-services.json` from Firebase Console (Android)\n3. Place both files in your project root (same level as `app.json`)\n\n```json\n{\n  \"expo\": {\n    \"plugins\": [\n      \"react-native-google-auth\"\n    ]\n  }\n}\n```\n\n#### Step 3: Configure Platform-Specific Settings\n\n**iOS Configuration in app.json:**\n\n```json\n{\n  \"expo\": {\n    \"ios\": {\n      \"bundleIdentifier\": \"com.yourcompany.yourapp\",\n      \"infoPlist\": {\n        \"GIDClientID\": \"YOUR_IOS_CLIENT_ID.apps.googleusercontent.com\"\n      }\n    }\n  }\n}\n```\n\n**Android Configuration in app.json:**\n\n```json\n{\n  \"expo\": {\n    \"android\": {\n      \"package\": \"com.yourcompany.yourapp\"\n    }\n  }\n}\n```\n\n#### Step 4: Create Development Build\n\n```bash\n# Login to EAS (if not already logged in)\neas login\n\n# Configure your project (if first time)\neas build:configure\n\n# Create development build\neas build --profile development --platform all\n\n# Or for specific platform\neas build --profile development --platform ios\neas build --profile development --platform android\n```\n\n#### Step 5: Install and Test\n\n1. Install the development build on your device\n2. Start the development server:\n   ```bash\n   npx expo start --dev-client\n   ```\n\n#### Step 6: Use in Your App\n\n```typescript\nimport { GoogleAuth, GoogleAuthScopes } from 'react-native-google-auth';\nimport { useEffect } from 'react';\n\nexport default function App() {\n  useEffect(() =\u003e {\n    configureGoogleAuth();\n  }, []);\n\n  const configureGoogleAuth = async () =\u003e {\n    try {\n      await GoogleAuth.configure({\n        // Client IDs are automatically detected from plugin configuration\n        scopes: [GoogleAuthScopes.EMAIL, GoogleAuthScopes.PROFILE]\n      });\n      console.log('Google Auth configured successfully');\n    } catch (error) {\n      console.error('Google Auth configuration failed:', error);\n    }\n  };\n\n  const handleGoogleSignIn = async () =\u003e {\n    try {\n      const response = await GoogleAuth.signIn();\n\n      if (response.type === 'success') {\n        console.log('User signed in:', response.data.user);\n        // Handle successful sign-in\n      } else if (response.type === 'cancelled') {\n        console.log('Sign in cancelled by user');\n      }\n    } catch (error) {\n      console.error('Sign in failed:', error);\n    }\n  };\n\n  // Your app components...\n}\n```\n\n#### Expo Plugin Options\n\nThe config plugin accepts the following options:\n\n```typescript\ninterface GoogleAuthPluginOptions {\n  iosClientId?: string;              // iOS OAuth client ID\n  androidClientId?: string;          // Android OAuth client ID\n  googleServicesFile?: string;       // Path to google-services.json (default: './google-services.json')\n  iosGoogleServicesFile?: string;    // Path to GoogleService-Info.plist (default: './GoogleService-Info.plist')\n}\n```\n\n**Example with custom file paths:**\n\n```json\n{\n  \"expo\": {\n    \"plugins\": [\n      [\n        \"react-native-google-auth\",\n        {\n          \"googleServicesFile\": \"./config/google-services.json\",\n          \"iosGoogleServicesFile\": \"./config/GoogleService-Info.plist\"\n        }\n      ]\n    ]\n  }\n}\n```\n\n### React Native CLI Setup\n\n#### iOS Setup\n\n1. **Install pods:**\n   ```bash\n   cd ios \u0026\u0026 pod install\n   ```\n\n2. **Configure Client ID (Choose one method):**\n\n   **Method A: Automatic Detection from Info.plist (Recommended)**\n\n   Add your iOS client ID to `ios/YourApp/Info.plist`:\n   ```xml\n   \u003ckey\u003eGIDClientID\u003c/key\u003e\n   \u003cstring\u003eYOUR_IOS_CLIENT_ID.apps.googleusercontent.com\u003c/string\u003e\n   ```\n\n   **Method B: Manual Configuration**\n\n   Provide the client ID directly in your configuration:\n   ```typescript\n   await GoogleAuth.configure({\n     iosClientId: 'YOUR_IOS_CLIENT_ID.apps.googleusercontent.com',\n     androidClientId: 'YOUR_ANDROID_CLIENT_ID.apps.googleusercontent.com'\n   });\n   ```\n\n3. **Add URL schemes to `ios/YourApp/Info.plist`:**\n   ```xml\n   \u003ckey\u003eCFBundleURLTypes\u003c/key\u003e\n   \u003carray\u003e\n     \u003cdict\u003e\n       \u003ckey\u003eCFBundleURLName\u003c/key\u003e\n       \u003cstring\u003ecom.yourcompany.yourapp\u003c/string\u003e\n       \u003ckey\u003eCFBundleURLSchemes\u003c/key\u003e\n       \u003carray\u003e\n         \u003cstring\u003ecom.googleusercontent.apps.YOUR_IOS_CLIENT_ID\u003c/string\u003e\n       \u003c/array\u003e\n     \u003c/dict\u003e\n   \u003c/array\u003e\n   ```\n\n4. **Configure URL handling in your `AppDelegate.swift`:**\n   ```swift\n   import GoogleSignIn\n\n   // Add this method to handle URL schemes\n   func application(\n     _ app: UIApplication,\n     open url: URL,\n     options: [UIApplication.OpenURLOptionsKey: Any] = [:]\n   ) -\u003e Bool {\n     return GIDSignIn.sharedInstance.handle(url)\n   }\n   ```\n\n#### Android Setup\n\n1. **Configure Client ID (Choose one method):**\n\n   **Method A: Automatic Detection from google-services.json (Recommended)**\n\n   Add your `google-services.json` file to `android/app/` directory.\n\n   \u003e **Important:** The library will automatically extract the Web client ID (client_type: 3) from your `google-services.json`. This is the correct client ID for Android Credential Manager authentication.\n\n   **Method B: Manual Configuration**\n\n   Provide the **Web application** client ID directly in your configuration:\n   ```typescript\n   await GoogleAuth.configure({\n     androidClientId: 'YOUR_WEB_CLIENT_ID.apps.googleusercontent.com', // Use Web OAuth client ID, NOT Android client ID\n     iosClientId: 'YOUR_IOS_CLIENT_ID.apps.googleusercontent.com'\n   });\n   ```\n\n   \u003e **Note:** The `androidClientId` should be your **Web application OAuth client ID** (client_type: 3 in google-services.json), not the Android OAuth client ID. The Android OAuth client is used only for linking your SHA-1 certificate to the project.\n\n## 🔧 Google Cloud Console Setup\n\n### Step 1: Create a Google Cloud Project\n\n1. Go to [Google Cloud Console](https://console.cloud.google.com/)\n2. Create a new project or select an existing one\n3. Enable the **Google Sign-In API**\n\n### Step 2: Configure OAuth Consent Screen\n\n1. Go to **APIs \u0026 Services** → **OAuth consent screen**\n2. Choose **External** (for public apps) or **Internal** (for G Suite domains)\n3. Fill in the required information:\n  - App name\n  - User support email\n  - Developer contact information\n4. Add scopes (at minimum: `email`, `profile`, `openid`)\n5. Save and continue\n\n### Step 3: Create OAuth 2.0 Client IDs\n\n#### For iOS:\n1. Go to **Credentials** → **Create Credentials** → **OAuth 2.0 Client IDs**\n2. Application type: **iOS**\n3. Name: Your app name (iOS)\n4. Bundle ID: Your iOS app's bundle identifier (e.g., `com.yourcompany.yourapp`)\n5. Click **Create**\n6. Copy the **Client ID** (ends with `.apps.googleusercontent.com`)\n\n#### For Android:\n\n**Important:** For Android, you need to create **both** an Android OAuth client AND a Web application OAuth client.\n\n**Step 1: Create Android OAuth Client (for SHA-1 certificate)**\n1. Go to **Credentials** → **Create Credentials** → **OAuth 2.0 Client IDs**\n2. Application type: **Android**\n3. Name: Your app name (Android)\n4. Package name: Your Android app's package name (e.g., `com.yourcompany.yourapp`)\n5. SHA-1 certificate fingerprint:\n\n   **For development:**\n   ```bash\n   keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android\n   ```\n\n   **For Expo development builds:**\n   ```bash\n   eas credentials -p android\n   ```\n\n   **For production:**\n   ```bash\n   keytool -list -v -keystore path/to/your/release.keystore -alias your-key-alias\n   ```\n\n6. Click **Create**\n\n**Step 2: Create Web Application OAuth Client (Required for Android Authentication)**\n1. Go to **Credentials** → **Create Credentials** → **OAuth 2.0 Client IDs**\n2. Application type: **Web application**\n3. Name: Your app name (Web)\n4. Click **Create**\n5. **Copy this Client ID** - this is what you'll use for `androidClientId` in your configuration\n\n\u003e **Why do I need a Web client ID for Android?**\n\u003e\n\u003e The Android Credential Manager API requires a Web OAuth client ID (client_type: 3) for authentication. This is used to generate ID tokens and authenticate with your backend server. The Android OAuth client (created in Step 1) is only used for associating your app's package name and SHA-1 certificate with your project.\n\u003e\n\u003e When you download `google-services.json`, look for the `oauth_client` entry with `\"client_type\": 3` - this is the Web client ID you should use in your `androidClientId` configuration.\n\n### Step 4: Download Configuration Files (Optional but Recommended)\n\n#### For iOS:\n1. In your OAuth 2.0 client, click **Download plist**\n2. Save as `GoogleService-Info.plist`\n3. Place in your project root (for Expo) or `ios/YourApp/` (for React Native CLI)\n\n#### For Android:\n1. Go to **Firebase Console** → **Project Settings** → **General**\n2. Add your Android app if not already added\n3. Download `google-services.json`\n4. Place in your project root (for Expo) or `android/app/` (for React Native CLI)\n\n## 💻 Usage\n\n### Import\n\n```typescript\nimport { GoogleAuth, GoogleAuthScopes } from 'react-native-google-auth';\n```\n\n### Configure (Required - Call this first)\n\n```typescript\nconst configure = async () =\u003e {\n  try {\n    await GoogleAuth.configure({\n      iosClientId: 'YOUR_IOS_CLIENT_ID.apps.googleusercontent.com', // Optional on iOS - auto-detected from Info.plist\n      androidClientId: 'YOUR_ANDROID_CLIENT_ID.apps.googleusercontent.com', // Optional on Android - auto-detected from google-services.json\n      webClientId: 'YOUR_WEB_CLIENT_ID.apps.googleusercontent.com', // Optional - for server verification\n      hostedDomain: 'yourdomain.com', // Optional - for G Suite domains\n      forceAccountPicker: true, // Optional (iOS only) - always show account picker, even if user is already signed in\n      scopes: [ // Optional - additional OAuth scopes\n        GoogleAuthScopes.EMAIL,\n        GoogleAuthScopes.PROFILE,\n        'https://www.googleapis.com/auth/drive.readonly',\n        'https://www.googleapis.com/auth/calendar.readonly'\n      ]\n    });\n    console.log('Google Auth configured successfully');\n  } catch (error) {\n    console.error('Configuration failed:', error);\n  }\n};\n```\n\n#### Force Account Picker (iOS)\n\nBy default, the library attempts silent sign-in first, which automatically signs in the user with their previously used Google account. To force the account picker to always show (useful when users have multiple Google accounts), use the `forceAccountPicker` option:\n\n```typescript\nawait GoogleAuth.configure({\n  iosClientId: 'YOUR_IOS_CLIENT_ID.apps.googleusercontent.com',\n  forceAccountPicker: true, // Always show account picker on iOS\n});\n```\n\n\u003e **Note:** This option only affects iOS. On Android, the Credential Manager API handles account selection automatically.\n\n### Sign In\n\n```typescript\nconst signIn = async () =\u003e {\n  try {\n    const response = await GoogleAuth.signIn();\n\n    if (response.type === 'success') {\n      const { user, idToken, accessToken } = response.data;\n      console.log('User:', user);\n      console.log('Access Token:', accessToken); // null on Android\n      console.log('ID Token:', idToken);\n    } else if (response.type === 'cancelled') {\n      console.log('Sign in was cancelled');\n    }\n  } catch (error) {\n    console.error('Sign in failed:', error);\n  }\n};\n```\n\n### Sign Out\n\n```typescript\nconst signOut = async () =\u003e {\n  try {\n    await GoogleAuth.signOut();\n    console.log('User signed out successfully');\n  } catch (error) {\n    console.error('Sign out failed:', error);\n  }\n};\n```\n\n### Get Tokens\n\n```typescript\nconst getTokens = async () =\u003e {\n  try {\n    const tokens = await GoogleAuth.getTokens();\n    console.log('ID Token:', tokens.idToken);\n    console.log('Access Token:', tokens.accessToken); // null on Android\n    console.log('User:', tokens.user);\n  } catch (error) {\n    console.error('Failed to get tokens:', error);\n  }\n};\n```\n\n### Get Current User\n\n```typescript\nconst getCurrentUser = async () =\u003e {\n  try {\n    const user = await GoogleAuth.getCurrentUser();\n    if (user) {\n      console.log('Current user:', user);\n    } else {\n      console.log('No user is currently signed in');\n    }\n  } catch (error) {\n    console.error('Failed to get current user:', error);\n  }\n};\n```\n\n### Refresh Tokens\n\n```typescript\nconst refreshTokens = async () =\u003e {\n  try {\n    const tokens = await GoogleAuth.refreshTokens();\n    console.log('Refreshed ID Token:', tokens.idToken);\n    console.log('Refreshed Access Token:', tokens.accessToken); // null on Android\n    console.log('User:', tokens.user);\n    console.log('Expires At:', tokens.expiresAt);\n  } catch (error) {\n    console.error('Token refresh failed:', error);\n  }\n};\n```\n\n### Check Token Expiration\n\n```typescript\nconst checkTokenExpiration = async () =\u003e {\n  try {\n    const isExpired = await GoogleAuth.isTokenExpired();\n    console.log('Token expired:', isExpired);\n\n    if (isExpired) {\n      // Refresh tokens if expired\n      await refreshTokens();\n    }\n  } catch (error) {\n    console.error('Failed to check token expiration:', error);\n  }\n};\n```\n\n### Check Play Services (Android)\n\n```typescript\nconst checkPlayServices = async () =\u003e {\n  try {\n    const playServicesInfo = await GoogleAuth.checkPlayServices(true); // Show error dialog if needed\n    console.log('Play Services available:', playServicesInfo.isAvailable);\n    console.log('Play Services status:', playServicesInfo.status); // Android only\n  } catch (error) {\n    console.error('Failed to check Play Services:', error);\n  }\n};\n```\n\n## 🔍 API Reference\n\n### GoogleAuth\n\n#### Methods\n\n- `configure(options: GoogleAuthConfig): Promise\u003cvoid\u003e`\n- `signIn(): Promise\u003cGoogleAuthResponse\u003e`\n- `signOut(): Promise\u003cvoid\u003e`\n- `getCurrentUser(): Promise\u003cGoogleUser | null\u003e`\n- `getTokens(): Promise\u003cGoogleTokens\u003e`\n- `refreshTokens(): Promise\u003cGoogleTokens\u003e`\n- `isTokenExpired(): Promise\u003cboolean\u003e`\n- `checkPlayServices(showErrorDialog?: boolean): Promise\u003cPlayServicesInfo\u003e`\n\n#### Types\n\n```typescript\ninterface GoogleAuthConfig {\n  iosClientId?: string;\n  androidClientId?: string;\n  webClientId?: string;\n  hostedDomain?: string;\n  scopes?: string[];\n  forceAccountPicker?: boolean; // iOS only - forces account picker to show even if user is already signed in\n}\n\ninterface GoogleAuthResponse {\n  type: 'success' | 'cancelled';\n  data?: {\n    user: GoogleUser;\n    idToken: string;\n    accessToken: string | null; // null on Android due to Credential Manager API limitations\n  };\n}\n\ninterface GoogleUser {\n  id: string;\n  email: string;\n  name: string;\n  photo?: string;\n  familyName?: string;\n  givenName?: string;\n}\n\ninterface GoogleTokens {\n  idToken: string;\n  accessToken: string | null; // null on Android due to Credential Manager API limitations\n  user?: GoogleUser;\n  expiresAt?: number;\n}\n\ninterface PlayServicesInfo {\n  isAvailable: boolean;\n  status?: number; // Android only - Google Play Services status code\n}\n```\n\n### GoogleAuthScopes\n\nCommon OAuth scopes:\n\n```typescript\nenum GoogleAuthScopes {\n  EMAIL = 'email',\n  PROFILE = 'profile',\n  OPENID = 'openid',\n  DRIVE = 'https://www.googleapis.com/auth/drive',\n  DRIVE_READONLY = 'https://www.googleapis.com/auth/drive.readonly',\n  CALENDAR = 'https://www.googleapis.com/auth/calendar',\n  CALENDAR_READONLY = 'https://www.googleapis.com/auth/calendar.readonly',\n}\n```\n\n## 🐛 Troubleshooting\n\n### Common Issues\n\n#### Expo-Specific Issues\n\n**1. \"Google Auth not configured\" in Expo**\n- Ensure you've added the config plugin to `app.json`\n- Rebuild your development build after adding the plugin\n- Verify client IDs are correctly set in the plugin configuration\n\n**2. \"Invalid client ID\" in Expo**\n- Check that your bundle identifier (iOS) and package name (Android) match your Google Cloud Console configuration\n- Ensure you're using the correct client IDs for your platform\n- Verify the client IDs include the full `.apps.googleusercontent.com` suffix\n\n**3. Build fails with Google Auth**\n- Make sure you're using Expo SDK 49+\n- Clear your build cache: `eas build --clear-cache`\n- Verify `google-services.json` and `GoogleService-Info.plist` are in the project root\n\n**4. Sign-in doesn't work in development build**\n- Ensure you're testing on a physical device (not Expo Go)\n- Check that Google Play Services are installed and updated (Android)\n- Verify your app's SHA-1 fingerprint is added to Google Cloud Console (Android)\n\n#### General Issues\n\n**1. \"DEVELOPER_ERROR\" on Android**\n- Verify your package name matches Google Cloud Console\n- Check SHA-1 fingerprint is correctly added to the Android OAuth client\n- Ensure you're using the **Web application OAuth client ID** (client_type: 3), not the Android OAuth client ID\n- Verify `google-services.json` is in the correct location (`android/app/`)\n- If manually configuring, ensure `androidClientId` is set to your Web OAuth client ID\n\n**2. \"SIGN_IN_REQUIRED\" error**\n- User needs to sign in first\n- Check if user session has expired\n\n**3. iOS URL scheme not working**\n- Verify URL scheme is correctly added to Info.plist\n- Check AppDelegate.swift has the URL handling code\n- Ensure the scheme matches your client ID (reversed)\n\n**4. Network errors**\n- Check internet connectivity\n- Verify Google Play Services are available (Android)\n- Check if your app is properly configured in Google Cloud Console\n\n#### Platform Differences\n\n**Important Note about Access Tokens:**\n- **iOS**: Returns both `idToken` and `accessToken`\n- **Android**: Returns `idToken` but `accessToken` is always `null` due to Android Credential Manager API limitations\n\nThe Android Credential Manager API focuses on authentication (ID tokens) rather than authorization (access tokens). If you need access tokens on Android for API calls, consider implementing a separate OAuth2 flow or use the ID token for server-side token exchange.\n\n### Getting Help\n\n1. Check the [GitHub Issues](https://github.com/sbaiahmed1/react-native-google-auth/issues)\n2. Review the [troubleshooting guide](./docs/troubleshooting.md)\n3. Join our [Discord community](https://discord.gg/your-discord)\n\n## 📚 Examples\n\n### Complete Expo Example\n\n```typescript\nimport React, { useEffect, useState } from 'react';\nimport { View, Text, TouchableOpacity, StyleSheet, Alert } from 'react-native';\nimport { GoogleAuth, GoogleAuthScopes, GoogleUser } from 'react-native-google-auth';\n\nexport default function App() {\n  const [user, setUser] = useState\u003cGoogleUser | null\u003e(null);\n  const [isConfigured, setIsConfigured] = useState(false);\n\n  useEffect(() =\u003e {\n    configureGoogleAuth();\n  }, []);\n\n  const configureGoogleAuth = async () =\u003e {\n    try {\n      await GoogleAuth.configure({\n        scopes: [GoogleAuthScopes.EMAIL, GoogleAuthScopes.PROFILE]\n      });\n      setIsConfigured(true);\n\n      // Check if user is already signed in\n      const currentUser = await GoogleAuth.getCurrentUser();\n      setUser(currentUser);\n    } catch (error) {\n      console.error('Google Auth configuration failed:', error);\n      Alert.alert('Configuration Error', 'Failed to configure Google Auth');\n    }\n  };\n\n  const handleSignIn = async () =\u003e {\n    if (!isConfigured) {\n      Alert.alert('Error', 'Google Auth is not configured');\n      return;\n    }\n\n    try {\n      const response = await GoogleAuth.signIn();\n\n      if (response.type === 'success') {\n        setUser(response.data.user);\n        Alert.alert('Success', `Welcome ${response.data.user.name}!`);\n      } else if (response.type === 'cancelled') {\n        Alert.alert('Cancelled', 'Sign in was cancelled');\n      }\n    } catch (error) {\n      console.error('Sign in failed:', error);\n      Alert.alert('Sign In Error', 'Failed to sign in with Google');\n    }\n  };\n\n  const handleSignOut = async () =\u003e {\n    try {\n      await GoogleAuth.signOut();\n      setUser(null);\n      Alert.alert('Success', 'Signed out successfully');\n    } catch (error) {\n      console.error('Sign out failed:', error);\n      Alert.alert('Sign Out Error', 'Failed to sign out');\n    }\n  };\n\n  return (\n    \u003cView style={styles.container}\u003e\n    \u003cText style={styles.title}\u003eGoogle Auth Example\u003c/Text\u003e\n\n  {user ? (\n    \u003cView style={styles.userInfo}\u003e\n    \u003cText style={styles.userText}\u003eWelcome, {user.name}!\u003c/Text\u003e\n    \u003cText style={styles.userText}\u003eEmail: {user.email}\u003c/Text\u003e\n  \u003cTouchableOpacity style={styles.button} onPress={handleSignOut}\u003e\n  \u003cText style={styles.buttonText}\u003eSign Out\u003c/Text\u003e\n  \u003c/TouchableOpacity\u003e\n  \u003c/View\u003e\n  ) : (\n    \u003cTouchableOpacity\n      style={[styles.button, !isConfigured \u0026\u0026 styles.buttonDisabled]}\n    onPress={handleSignIn}\n    disabled={!isConfigured}\n  \u003e\n    \u003cText style={styles.buttonText}\u003e\n      {isConfigured ? 'Sign In with Google' : 'Configuring...'}\n      \u003c/Text\u003e\n      \u003c/TouchableOpacity\u003e\n  )}\n  \u003c/View\u003e\n);\n}\n\nconst styles = StyleSheet.create({\n  container: {\n    flex: 1,\n    justifyContent: 'center',\n    alignItems: 'center',\n    padding: 20,\n  },\n  title: {\n    fontSize: 24,\n    fontWeight: 'bold',\n    marginBottom: 30,\n  },\n  userInfo: {\n    alignItems: 'center',\n  },\n  userText: {\n    fontSize: 16,\n    marginBottom: 10,\n  },\n  button: {\n    backgroundColor: '#4285F4',\n    paddingHorizontal: 20,\n    paddingVertical: 12,\n    borderRadius: 8,\n    marginTop: 20,\n  },\n  buttonDisabled: {\n    backgroundColor: '#ccc',\n  },\n  buttonText: {\n    color: 'white',\n    fontSize: 16,\n    fontWeight: 'bold',\n  },\n});\n```\n\n### React Native CLI Example\n\n```typescript\nimport React, { useEffect, useState } from 'react';\nimport { View, Text, TouchableOpacity, StyleSheet } from 'react-native';\nimport { GoogleAuth, GoogleAuthScopes, GoogleUser } from 'react-native-google-auth';\n\nconst App = () =\u003e {\n  const [user, setUser] = useState\u003cGoogleUser | null\u003e(null);\n\n  useEffect(() =\u003e {\n    configureGoogleAuth();\n  }, []);\n\n  const configureGoogleAuth = async () =\u003e {\n    try {\n      await GoogleAuth.configure({\n        iosClientId: 'YOUR_IOS_CLIENT_ID.apps.googleusercontent.com',\n        androidClientId: 'YOUR_ANDROID_CLIENT_ID.apps.googleusercontent.com',\n        scopes: [GoogleAuthScopes.EMAIL, GoogleAuthScopes.PROFILE]\n      });\n\n      // Check if user is already signed in\n      const currentUser = await GoogleAuth.getCurrentUser();\n      setUser(currentUser);\n    } catch (error) {\n      console.error('Configuration failed:', error);\n    }\n  };\n\n  const signIn = async () =\u003e {\n    try {\n      const response = await GoogleAuth.signIn();\n      if (response.type === 'success') {\n        setUser(response.data.user);\n      }\n    } catch (error) {\n      console.error('Sign in failed:', error);\n    }\n  };\n\n  const signOut = async () =\u003e {\n    try {\n      await GoogleAuth.signOut();\n      setUser(null);\n    } catch (error) {\n      console.error('Sign out failed:', error);\n    }\n  };\n\n  return (\n    \u003cView style={styles.container}\u003e\n      {user ? (\n          \u003cView\u003e\n            \u003cText\u003eWelcome, {user.name}!\u003c/Text\u003e\n          \u003cTouchableOpacity style={styles.button} onPress={signOut}\u003e\n        \u003cText style={styles.buttonText}\u003eSign Out\u003c/Text\u003e\n      \u003c/TouchableOpacity\u003e\n      \u003c/View\u003e\n  ) : (\n    \u003cTouchableOpacity style={styles.button} onPress={signIn}\u003e\n  \u003cText style={styles.buttonText}\u003eSign In with Google\u003c/Text\u003e\n  \u003c/TouchableOpacity\u003e\n    )}\n  \u003c/View\u003e\n);\n};\n\nconst styles = StyleSheet.create({\n  container: {\n    flex: 1,\n    justifyContent: 'center',\n    alignItems: 'center',\n  },\n  button: {\n    backgroundColor: '#4285F4',\n    padding: 15,\n    borderRadius: 8,\n    margin: 10,\n  },\n  buttonText: {\n    color: 'white',\n    fontSize: 16,\n    fontWeight: 'bold',\n  },\n});\n\nexport default App;\n```\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## 🤝 Contributing\n\nWe welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.\n\n## 📞 Support\n\n- 🐛 Issues: [GitHub Issues](https://github.com/sbaiahmed1/react-native-google-auth/issues)\n\n---\n\nMade with ❤️ by @sbaiahmed1\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbaiahmed1%2Freact-native-google-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsbaiahmed1%2Freact-native-google-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbaiahmed1%2Freact-native-google-auth/lists"}