-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch-doc-1735224934179.json
1 lines (1 loc) · 84.5 KB
/
search-doc-1735224934179.json
1
{"searchDocs":[{"title":"WebGoogleSigninButton","type":0,"sectionRef":"#","url":"/docs/buttons/web","content":"","keywords":"","version":null},{"title":"How to use this","type":1,"pageTitle":"WebGoogleSigninButton","url":"/docs/buttons/web#how-to-use-this","content":" As the Modern Sign In Guide explains, there are two ways to sign in on the web: using the One-tap UI or using the Google Sign-In button. One-tap UI may not always be available: This happens if user has opted out or when they close the dialog several times in a row, entering the cooldown period. The Google Sign-In button serves as a fallback. Tapping it will open the regular Google Sign-In dialog. import { WebGoogleSigninButton } from '@react-native-google-signin/google-signin'; <WebGoogleSigninButton />; ","version":null,"tagName":"h3"},{"title":"Props","type":1,"pageTitle":"WebGoogleSigninButton","url":"/docs/buttons/web#props","content":" All props are optional. Name\tType\tDescriptiontype?\t"standard" | "icon"\tThe type of the sign-in button. theme?\t"outline" | "filled_blue" | "filled_black"\tThe theme of the sign-in button. size?\t"large" | "medium" | "small"\tThe size of the sign-in button. text?\t"signin_with" | "signup_with" | "continue_with" | "signin"\tThe text to display on the sign-in button. shape?\t"rectangular" | "pill" | "circle" | "square"\tThe shape of the sign-in button. width?\tnumber\tThe width of the sign-in button. locale?\tstring\tThe locale for the sign-in button. logoAlignment?\t"left" | "center"\tThe alignment of the logo on the button. onError?\t(error: Error) => void\tCalled when you try to render the button before the Client SDK is loaded. ","version":null,"tagName":"h2"},{"title":"GoogleSigninButton","type":0,"sectionRef":"#","url":"/docs/buttons/native","content":"","keywords":"","version":null},{"title":"Props","type":1,"pageTitle":"GoogleSigninButton","url":"/docs/buttons/native#props","content":" ","version":null,"tagName":"h2"},{"title":"size","type":1,"pageTitle":"GoogleSigninButton","url":"/docs/buttons/native#size","content":" Possible values: Size.Icon: display only Google icon. Recommended size of 48 x 48.Size.Standard: icon with 'Sign in'. Recommended size of 230 x 48.Size.Wide: icon with 'Sign in with Google'. Recommended size of 312 x 48. Default: GoogleSigninButton.Size.Standard. Given the size prop you pass, we'll automatically apply the recommended size, but you can override it by passing the style prop as in style={{ width, height }}. ","version":null,"tagName":"h3"},{"title":"color","type":1,"pageTitle":"GoogleSigninButton","url":"/docs/buttons/native#color","content":" Possible values: Color.Dark: apply a blue backgroundColor.Light: apply a light gray background ","version":null,"tagName":"h3"},{"title":"disabled","type":1,"pageTitle":"GoogleSigninButton","url":"/docs/buttons/native#disabled","content":" Boolean. If true, all interactions for the button are disabled. ","version":null,"tagName":"h3"},{"title":"onPress","type":1,"pageTitle":"GoogleSigninButton","url":"/docs/buttons/native#onpress","content":" Handler to be called when the user taps the button ","version":null,"tagName":"h3"},{"title":"Inherited View props...","type":1,"pageTitle":"GoogleSigninButton","url":"/docs/buttons/native#inherited-view-props","content":"","version":null,"tagName":"h3"},{"title":"Integration notes","type":0,"sectionRef":"#","url":"/docs/integration-notes","content":"","keywords":"","version":null},{"title":"Additional scopes","type":1,"pageTitle":"Integration notes","url":"/docs/integration-notes#additional-scopes","content":" The default requested scopes are email and profile. If you want to manage other data from your application (for example access user agenda or upload a file to drive) you need to request additional permissions. This can be accomplished by adding the necessary scopes when configuring the GoogleSignin instance. Visit https://developers.google.com/identity/protocols/googlescopes or https://developers.google.com/oauthplayground/ for a list of available scopes. ","version":null,"tagName":"h2"},{"title":"Installation","type":0,"sectionRef":"#","url":"/docs/install","content":"","keywords":"","version":null},{"title":"Modern version","type":1,"pageTitle":"Installation","url":"/docs/install#sponsor-only-version","content":" Available to GitHub sponsors of the maintainer and Expo customers, this version includes: ⚡️Modern Sign In implemented with: Android: latest Credential Manager libraryWeb: Sign In with Google for WebiOS & macOS: Google Sign-In SDK 🛡️ Advanced security features 🔧 Easier configuration - some parameters can be detected automatically 🖥️ Full platform support - Deploy everywhere with a unified api: Android, iOS, Web, and macOS ✅ An example app - to showcase all Modern Sign In features Your support helps improve the module and upstream SDKs (such as 1, 2). Thank you for enabling better tools for the community! ❤️ ","version":null,"tagName":"h3"},{"title":"Public version","type":1,"pageTitle":"Installation","url":"/docs/install#public-version","content":" Available on the public npm registry, this version: Has platform support limited to Android and iOS.Uses functional, but deprecated Legacy Android Google Sign-In.Contains none of the extra features listed above. ","version":null,"tagName":"h3"},{"title":"Obtaining access to the Modern version","type":1,"pageTitle":"Installation","url":"/docs/install#obtaining-access","content":" You can get access either by sponsoring (use specifically the tiers that mention this project!) or as an Expo customer through this form. Note that this version is distributed under a custom license. You will receive an invitation to access the private repo with the sources and examples, as well as to the private npm package. Three steps are needed to access the private package, which is hosted on GitHub npm packages registry. Become a sponsor or complete the form and accept the private repository invitation. Obtain here a Personal Access Token with packages:read permission. Set up your package manager so that it fetches the package from the GH packages registry instead of the public registry. In this example, we're using an NPM_TOKEN_GOOGLE_SIGN_IN environment variable. npm / yarn v1yarn v3+ create a .npmrc file in your project root with the following content: .npmrc //npm.pkg.github.com/:_authToken=${NPM_TOKEN_GOOGLE_SIGN_IN} @react-native-google-signin:registry=https://npm.pkg.github.com/ If you use another package manager (such as Bun), refer to its documentation on how to set up a custom registry. ","version":null,"tagName":"h2"},{"title":"Requirements","type":1,"pageTitle":"Installation","url":"/docs/install#requirements","content":" The package supports Expo SDK >= 50 / React Native >= 0.73. Unofficially, it may work with older versions, but it's not guaranteed. If you're using the New Architecture, it's strongly recommended to use the latest React Native version available. ","version":null,"tagName":"h2"},{"title":"Installing","type":1,"pageTitle":"Installation","url":"/docs/install#installing","content":" yarn add @react-native-google-signin/google-signin@latest If you're using the Modern version, open the npm lockfile (yarn.lock or package-lock.json) and verify that the package is fetched from the GitHub registry (the entry must point to npm.pkg.github.com, not registry.npmjs.org). If it does not, it means that your package manager is not configured correctly. There are several guides to follow now: Expo guide for native mobile apps built with ExpoWeb guide if you want to use the package on webIf you're not using Expo but plain React Native, follow Android guide and iOS guide ","version":null,"tagName":"h2"},{"title":"Jest module mock","type":0,"sectionRef":"#","url":"/docs/jest-mock","content":"Jest module mock If you use Jest for testing, you may need to mock the functionality of the native module. This library ships with a Jest mock that you can add to the setupFiles array in your Jest config. By default, the mock behaves as if the calls were successful and returns mock user data. jest.config.js|ts|mjs|cjs|json { "setupFiles": [ "./node_modules/@react-native-google-signin/google-signin/jest/build/jest/setup.js" ] } ","keywords":"","version":null},{"title":"Error handling","type":0,"sectionRef":"#","url":"/docs/errors","content":"","keywords":"","version":null},{"title":"isErrorWithCode(value)","type":1,"pageTitle":"Error handling","url":"/docs/errors#iserrorwithcodevalue","content":" TypeScript helper to check if the passed parameter is an instance of Error which has the code property. All errors thrown by this library have the code property, which contains a value from statusCodes or some other string for the less-usual errors. isErrorWithCode can be used to avoid as casting when you want to access the code property on errors returned by the module. import { isErrorWithCode, GoogleSignin, } from '@react-native-google-signin/google-signin'; try { const userInfo = await GoogleSignin.signIn(); // do something with userInfo } catch (error) { if (isErrorWithCode(error)) { // here you can safely read `error.code` and TypeScript will know that it has a value } else { // this error does not have a `code`, and does not come from the Google Sign in module } } ","version":null,"tagName":"h3"},{"title":"Status Codes","type":1,"pageTitle":"Error handling","url":"/docs/errors#status-codes","content":" import { statusCodes } from '@react-native-google-signin/google-signin'; Status codes are useful when determining which kind of error has occurred during the sign-in process. Under the hood, these constants are derived from native GoogleSignIn error codes and are platform-specific. Always compare error.code to statusCodes.* and do not rely on the raw value of error.code. See example usage. Name\tDescriptionIN_PROGRESS\tTrying to invoke another operation (e.g. signInSilently) when previous one has not yet finished. If you call e.g. signInSilently twice, two calls to signInSilently in the native module will be done. The promise from the first call to signInSilently will be rejected with this error, and the second will resolve / reject with the result of the native call. PLAY_SERVICES_NOT_AVAILABLE\tPlay services are not available or outdated. This happens on Android, or on the web when you're calling the exposed APIs before the Client library is loaded. ","version":null,"tagName":"h3"},{"title":"Status codes specific to Modern sign in","type":1,"pageTitle":"Error handling","url":"/docs/errors#modern-status-codes","content":" Name\tDescriptionONE_TAP_START_FAILED\tThrown only on Android when the Modern sign in UI cannot be presented. This happens during the cooldown period. You can still call presentExplicitSignIn in that case. See example usage. ","version":null,"tagName":"h3"},{"title":"Migrating to new JS API","type":0,"sectionRef":"#","url":"/docs/migrating","content":"","keywords":"","version":null},{"title":"Modern sign in module","type":1,"pageTitle":"Migrating to new JS API","url":"/docs/migrating#modern-sign-in-module","content":" Add the configure method to your code. This method is required to be called to configure the module. Change the signIn, createAccount, presentExplicitSignIn, and requestAuthorization methods to use the new apis: That means that the data you previously accessed directly on userInfo (see below - for example userInfo.name) will now be nested in userInfo.data (e.g. userInfo.data.name). See OneTapResponse type: const signIn = async () => { try { - const userInfo = await GoogleOneTapSignIn.signIn({ - webClientId: `autoDetect`, // works only if you use Firebase - iosClientId: config.iosClientId, // only needed if you're not using Firebase - }); - setState({ userInfo }); // use e.g. `userInfo.name` + const response = await GoogleOneTapSignIn.signIn(); + + if (response.type === 'success') { + setState({ userInfo: response.data }); + } else if (response.type === 'noSavedCredentialFound') { + // Android and Apple only. No saved credential found, call `createAccount` + } } catch (error) { if (isErrorWithCode(error)) { switch (error.code) { - case statusCodes.NO_SAVED_CREDENTIAL_FOUND: - // Android and Apple only. No saved credential found, call `createAccount` - break; - case statusCodes.SIGN_IN_CANCELLED: - // sign in was cancelled - break; case statusCodes.ONE_TAP_START_FAILED: // Android-only, you probably have hit rate limiting. // On Android, you can still call `presentExplicitSignIn` in this case. break; case statusCodes.PLAY_SERVICES_NOT_AVAILABLE: // Android-only: play services not available or outdated // Web: when calling an unimplemented api (requestAuthorization) break; default: // something else happened } } else { // an error that's not related to google sign in occurred } } }; If requesting offline access in requestAuthorization on Android, add enabled: true: await GoogleOneTapSignIn.requestAuthorization({ offlineAccess: { + enabled: true, }, }); ","version":null,"tagName":"h2"},{"title":"Original Sign In","type":1,"pageTitle":"Migrating to new JS API","url":"/docs/migrating#original-sign-in","content":" Follow step 2. from above for signIn, addScopes and signInSilently methods.remove SIGN_IN_REQUIRED mentions. This case is now handled with NoSavedCredentialFound object: const getCurrentUserInfo = async () => { try { const response = await GoogleSignin.signInSilently(); + if (isSuccessResponse(response)) { + setState({ userInfo: response.data }) + } else if (isNoSavedCredentialFoundResponse(response)) { + // user has not signed in yet + } - setState({ userInfo: response }); } catch (error) { - if (error.code === statusCodes.SIGN_IN_REQUIRED) { - // user has not signed in yet - } else { - // some other error - } } }; ","version":null,"tagName":"h2"},{"title":"Other libraries","type":0,"sectionRef":"#","url":"/docs/other-libs","content":"","keywords":"","version":null},{"title":"react-native-theme-control","type":1,"pageTitle":"Other libraries","url":"/docs/other-libs#react-native-theme-control","content":" Natively control react native application theme at runtime and persist it for the next app start. ","version":null,"tagName":"h3"},{"title":"react-navigation-header-buttons","type":1,"pageTitle":"Other libraries","url":"/docs/other-libs#react-navigation-header-buttons","content":" Easily render header buttons for react-navigation. ","version":null,"tagName":"h3"},{"title":"react-to-imperative","type":1,"pageTitle":"Other libraries","url":"/docs/other-libs#react-to-imperative","content":" Convert React (Native) components for imperative use. ","version":null,"tagName":"h3"},{"title":"react-native-datetimepicker","type":1,"pageTitle":"Other libraries","url":"/docs/other-libs#react-native-datetimepicker","content":" React Native date & time picker component for iOS and Android. ","version":null,"tagName":"h3"},{"title":"JS-lingui","type":1,"pageTitle":"Other libraries","url":"/docs/other-libs#js-lingui","content":" A readable, automated, and optimized internationalization for JavaScript. ","version":null,"tagName":"h3"},{"title":"react-native-document-picker","type":1,"pageTitle":"Other libraries","url":"/docs/other-libs#react-native-document-picker","content":" Document Picker for React Native. ","version":null,"tagName":"h3"},{"title":"Advanced security","type":0,"sectionRef":"#","url":"/docs/security","content":"","keywords":"","version":null},{"title":"Custom nonce","type":1,"pageTitle":"Advanced security","url":"/docs/security#custom-nonce","content":" Nonce (number used once) is a security measure used to mitigate replay attacks and to associate a Client session with an ID Token. The authorization APIs in Modern Google Sign-In for Apple, Android and web allow you to specify a nonce. Example usage: const response = await GoogleOneTapSignIn.createAccount({ nonce: getUrlSafeNonce(), }); getUrlSafeNonce() generates a URL-safe nonce. It can be implemented using expo-crypto or react-native-get-random-values: expo-cryptoreact-native-get-random-values import * as Crypto from 'expo-crypto'; export function getUrlSafeNonce(byteLength = 32) { if (byteLength < 1) { throw new Error('Byte length must be positive'); } const randomBytes = Crypto.getRandomValues(new Uint8Array(byteLength)); return btoa(String.fromCharCode(...randomBytes)) .replace(/\\+/g, '-') .replace(/\\//g, '_') .replace(/[=]/g, ''); } ","version":null,"tagName":"h2"},{"title":"Usage with Supabase","type":1,"pageTitle":"Advanced security","url":"/docs/security#usage-with-supabase","content":" Auth providers such as Supabase require passing SHA-256 hash (digest) of the nonce (source). This can be done as follows: import { digestStringAsync, CryptoDigestAlgorithm } from 'expo-crypto'; export const getNonce = async () => { // `rawNonce` goes to Supabase's signInWithIdToken(). // Supabase makes a hash of `rawNonce` and compares it with the `nonceDigest` // which is included in the ID token from RN-google-signin. const rawNonce = getUrlSafeNonce(); // `nonceDigest` goes to the `nonce` parameter in RN-google-signin APIs const nonceDigest = await digestStringAsync( CryptoDigestAlgorithm.SHA256, rawNonce, ); return { rawNonce, nonceDigest }; }; ","version":null,"tagName":"h3"},{"title":"App Check for iOS (advanced)","type":1,"pageTitle":"Advanced security","url":"/docs/security#appcheck","content":" App Check helps protect your apps from abuse by preventing unauthorized clients from authenticating using Google Sign-in: only the apps you've authorized can acquire access tokens and ID tokens from Google's OAuth 2.0 and OpenID Connect endpoint. Read more about App Check to understand it. ","version":null,"tagName":"h2"},{"title":"Setup","type":1,"pageTitle":"Advanced security","url":"/docs/security#setup","content":" To set up App Check: Set up Google API Console / Firebase console by following "1. Set up your project". Do not follow step 2. Add App Attest capability to your app (as in here). If you're using Expo, the capability can be added according to the iOS capabilities documentation. (skip if you use Expo): Ensure that GIDClientID (the iOS client ID) is set in your Info.plist. Expo config plugin does this for you. ","version":null,"tagName":"h3"},{"title":"Usage","type":1,"pageTitle":"Advanced security","url":"/docs/security#usage","content":" Call GoogleOneTapSignIn.enableAppCheck() as shown below. Do this early, before invoking any authentication apis. The call either resolves when it succeeds or rejects with an error. On platforms other than iOS, the method is a no-op and resolves. Production environmentDebug provider (recommended)Debug provider (alternative) await GoogleOneTapSignIn.enableAppCheck(); ","version":null,"tagName":"h3"},{"title":"Enable App Check enforcement","type":1,"pageTitle":"Advanced security","url":"/docs/security#enable-app-check-enforcement","content":" Read the official documentation to understand how to enforce App Check. ","version":null,"tagName":"h3"},{"title":"Original Google sign in","type":0,"sectionRef":"#","url":"/docs/original","content":"","keywords":"","version":null},{"title":"configure","type":1,"pageTitle":"Original Google sign in","url":"/docs/original#configure","content":" signature: (options: ConfigureParams) => void It is mandatory to call this method before attempting to call signIn() and signInSilently(). This method is synchronous, meaning you can call signIn / signInSilently right after it. Typically, you would call configure only once, soon after your app starts. All parameters are optional. Example usage with default options: you'll get user email and basic profile info. import { GoogleSignin } from '@react-native-google-signin/google-signin'; GoogleSignin.configure(); An example with all options enumerated: GoogleSignin.configure({ webClientId: '<FROM DEVELOPER CONSOLE>', // client ID of type WEB for your server. Required to get the `idToken` on the user object, and for offline access. scopes: ['https://www.googleapis.com/auth/drive.readonly'], // what API you want to access on behalf of the user, default is email and profile offlineAccess: true, // if you want to access Google API on behalf of the user FROM YOUR SERVER hostedDomain: '', // specifies a hosted domain restriction forceCodeForRefreshToken: false, // [Android] related to `serverAuthCode`, read the docs link below *. accountName: '', // [Android] specifies an account name on the device that should be used iosClientId: '<FROM DEVELOPER CONSOLE>', // [iOS] if you want to specify the client ID of type iOS (otherwise, it is taken from GoogleService-Info.plist) googleServicePlistPath: '', // [iOS] if you renamed your GoogleService-Info file, new name here, e.g. "GoogleService-Info-Staging" openIdRealm: '', // [iOS] The OpenID2 realm of the home web server. This allows Google to include the user's OpenID Identifier in the OpenID Connect ID token. profileImageSize: 120, // [iOS] The desired height (and width) of the profile image. Defaults to 120px }); * forceCodeForRefreshToken docs ","version":null,"tagName":"h3"},{"title":"signIn","type":1,"pageTitle":"Original Google sign in","url":"/docs/original#signin","content":" signature: (options: SignInParams) => Promise<SignInResponse> Prompts a modal to let the user sign in into your application. Resolved promise returns an SignInResponse object. Rejects with an error otherwise. signIn example // import statusCodes along with GoogleSignin import { GoogleSignin, statusCodes, } from '@react-native-google-signin/google-signin'; // Somewhere in your code const signIn = async () => { try { await GoogleSignin.hasPlayServices(); const response = await GoogleSignin.signIn(); if (isSuccessResponse(response)) { setState({ userInfo: response.data }); } else { // sign in was cancelled by user } } catch (error) { if (isErrorWithCode(error)) { switch (error.code) { case statusCodes.IN_PROGRESS: // operation (eg. sign in) already in progress break; case statusCodes.PLAY_SERVICES_NOT_AVAILABLE: // Android only, play services not available or outdated break; default: // some other error happened } } else { // an error that's not related to google sign in occurred } } }; ","version":null,"tagName":"h3"},{"title":"Utility Functions","type":1,"pageTitle":"Original Google sign in","url":"/docs/original#utility-functions","content":" tip There are 4 helper functions available: isErrorWithCode for processing errorsisSuccessResponse for checking if a response represents a successful operation. Same as checking response.type === 'success'.isNoSavedCredentialFoundResponse for checking if a response represents no saved credentials case. Same as checking response.type === 'noSavedCredentialFound'.isCancelledResponse for checking if a response represents user cancellation case. Same as checking response.type === 'cancelled'. ","version":null,"tagName":"h3"},{"title":"addScopes","type":1,"pageTitle":"Original Google sign in","url":"/docs/original#addscopes","content":" signature: (options: AddScopesParams) => Promise<SignInResponse | null> This method resolves with SignInResponse object or with null if no user is currently logged in. You may not need this call: you can supply required scopes to the configure call. However, if you want to gain access to more scopes later, use this call. Example: const response = await GoogleSignin.addScopes({ scopes: ['https://www.googleapis.com/auth/user.gender.read'], }); ","version":null,"tagName":"h3"},{"title":"signInSilently","type":1,"pageTitle":"Original Google sign in","url":"/docs/original#signinsilently","content":" signature: () => Promise<SignInSilentlyResponse> May be called e.g. after of your main component mounts. This method returns a Promise that resolves with the SignInSilentlyResponse object and rejects with an error otherwise. To see how to handle errors read signIn() method const getCurrentUser = async () => { try { const response = await GoogleSignin.signInSilently(); if (isSuccessResponse(response)) { setState({ userInfo: response.data }); } else if (isNoSavedCredentialFoundResponse(response)) { // user has not signed in yet, or they have revoked access } } catch (error) { // handle errror } }; ","version":null,"tagName":"h3"},{"title":"hasPreviousSignIn","type":1,"pageTitle":"Original Google sign in","url":"/docs/original#hasprevioussignin","content":" signature: () => boolean This synchronous method may be used to find out whether some user previously signed in. Note that hasPreviousSignIn() can return true but getCurrentUser() can return null, in which case you can call signInSilently() to recover the user. However, it may happen that calling signInSilently() rejects with an error (e.g. due to a network issue). const hasPreviousSignIn = async () => { const hasPreviousSignIn = GoogleSignin.hasPreviousSignIn(); setState({ hasPreviousSignIn }); }; ","version":null,"tagName":"h3"},{"title":"getCurrentUser","type":1,"pageTitle":"Original Google sign in","url":"/docs/original#getcurrentuser","content":" signature: () => User | null This is a synchronous method that returns null or User object of the currently signed-in user. const getCurrentUser = async () => { const currentUser = GoogleSignin.getCurrentUser(); setState({ currentUser }); }; ","version":null,"tagName":"h3"},{"title":"clearCachedAccessToken","type":1,"pageTitle":"Original Google sign in","url":"/docs/original#clearcachedaccesstoken","content":" signature: (accessTokenString: string) => Promise<null> This method only has an effect on Android. You may run into a 401 Unauthorized error when a token is invalid. Call this method to remove the token from local cache and then call getTokens() to get fresh tokens. Calling this method on iOS does nothing and always resolves. This is because on iOS, getTokens() always returns valid tokens, refreshing them first if they have expired or are about to expire (see docs). ","version":null,"tagName":"h3"},{"title":"getTokens","type":1,"pageTitle":"Original Google sign in","url":"/docs/original#gettokens","content":" signature: () => Promise<GetTokensResponse> Resolves with an object containing { idToken: string, accessToken: string, } or rejects with an error. Note that using accessToken for identity assertion on your backend server is discouraged. ","version":null,"tagName":"h3"},{"title":"signOut","type":1,"pageTitle":"Original Google sign in","url":"/docs/original#signout","content":" signature: () => Promise<null> Signs out the current user. const signOut = async () => { try { await GoogleSignin.signOut(); setState({ user: null }); // Remember to remove the user from your app's state as well } catch (error) { console.error(error); } }; ","version":null,"tagName":"h3"},{"title":"revokeAccess","type":1,"pageTitle":"Original Google sign in","url":"/docs/original#revokeaccess","content":" signature: () => Promise<null> Removes your application from the user authorized applications. Read more about it here and here. const revokeAccess = async () => { try { await GoogleSignin.revokeAccess(); // Google Account disconnected from your app. // Perform clean-up actions, such as deleting data associated with the disconnected account. } catch (error) { console.error(error); } }; ","version":null,"tagName":"h3"},{"title":"hasPlayServices","type":1,"pageTitle":"Original Google sign in","url":"/docs/original#hasplayservices","content":" signature: (options: HasPlayServicesParams) => Promise<boolean> Checks if device has Google Play Services installed. Always resolves to true on iOS. Presence of up-to-date Google Play Services is required to show the sign in modal, but it is not required to perform calls to configure and signInSilently. Therefore, we recommend to call hasPlayServices directly before signIn. try { await GoogleSignin.hasPlayServices({ showPlayServicesUpdateDialog: true }); // google services are available } catch (err) { console.error('play services are not available'); } hasPlayServices accepts one parameter, an object which contains a single key: showPlayServicesUpdateDialog (defaults to true). When showPlayServicesUpdateDialog is set to true the library will prompt the user to take action to solve the issue, as seen in the figure below. You may also use this call at any time to find out if Google Play Services are available and react to the result as necessary. ","version":null,"tagName":"h3"},{"title":"Android setup guide","type":0,"sectionRef":"#","url":"/docs/setting-up/android","content":"","keywords":"","version":null},{"title":"Ensure compatibility","type":1,"pageTitle":"Android setup guide","url":"/docs/setting-up/android#ensure-compatibility","content":" If you're using the sponsor package: If you're using RN >= 0.73, you're good to go. But if you're using RN 0.72 or older, you need to specify compileSdkVersion 34 in android/build.gradle of your project as highlighted below. ","version":null,"tagName":"h3"},{"title":"Google project configuration","type":1,"pageTitle":"Android setup guide","url":"/docs/setting-up/android#google-project-configuration","content":" Follow this guide to set up your project and get the configuration information which you'll need later. ","version":null,"tagName":"h2"},{"title":"Without Firebase Authentication","type":1,"pageTitle":"Android setup guide","url":"/docs/setting-up/android#without-firebase-authentication","content":" You don't need to do any more modifications. ","version":null,"tagName":"h3"},{"title":"With Firebase Authentication","type":1,"pageTitle":"Android setup guide","url":"/docs/setting-up/android#with-firebase-authentication","content":" 1. Download the configuration file Download the configuration file (google-services.json) from Firebase. Then, place it into your project according to these instructions. 2. Update gradle files Update android/build.gradle with android/build.gradle buildscript { ext { buildToolsVersion = "a.b.c" minSdkVersion = x compileSdkVersion = y targetSdkVersion = z googlePlayServicesAuthVersion = "20.7.0" // <--- use this version or newer } // ... dependencies { classpath 'com.google.gms:google-services:4.4.0' // <--- use this version or newer } } Update android/app/build.gradle with android/app/build.gradle apply plugin: "com.android.application" apply plugin: "org.jetbrains.kotlin.android" apply plugin: "com.facebook.react" apply plugin: 'com.google.gms.google-services' This ends the setup for Firebase. ","version":null,"tagName":"h3"},{"title":"Rebuild the native project","type":1,"pageTitle":"Android setup guide","url":"/docs/setting-up/android#rebuild-the-native-project","content":" Do not forget to rebuild the native app after the setup is done. ","version":null,"tagName":"h2"},{"title":"Choose Dependency versions (optional)","type":1,"pageTitle":"Android setup guide","url":"/docs/setting-up/android#choose-dependency-versions-optional","content":" The library depends on com.google.android.gms:play-services-auth, as seen in build.gradle. If needed, you may control their versions by the ext closure, as seen in the code snippet above. ","version":null,"tagName":"h2"},{"title":"Modern Google sign in","type":0,"sectionRef":"#","url":"/docs/one-tap","content":"","keywords":"","version":null},{"title":"configure","type":1,"pageTitle":"Modern Google sign in","url":"/docs/one-tap#configure","content":" signature: (params: OneTapConfigureParams) => void It is mandatory to call configure before attempting to call any of the sign-in methods. This method is synchronous, meaning you can call e.g. signIn right after it. Typically, you would call configure only once, soon after your app starts. webClientId is a required parameter. Use "autoDetect" for automatic webClientId detection. If you're using neither Expo nor Firebase, you need to provide the iosClientId parameter. All other parameters are optional. Example of calling the configure() method GoogleOneTapSignIn.configure({ webClientId: 'autoDetect', }); ","version":null,"tagName":"h3"},{"title":"checkPlayServices","type":1,"pageTitle":"Modern Google sign in","url":"/docs/one-tap#checkplayservices","content":" ✨since v17.3.0 signature: (showErrorResolutionDialog?: boolean): Promise<PlayServicesInfo> The behavior of checkPlayServices varies across platforms: Android: The function resolves if the device has Play Services installed and their version is >= the minimum required version. Otherwise, it rejects with statusCodes.PLAY_SERVICES_NOT_AVAILABLE error code, and more information in userInfo field (see below). On Android, presence of up-to-date Google Play Services is required to call any of the provided authentication and authorization methods. It is therefore necessary to call checkPlayServices any time prior to calling the authentication / authorization methods and only call those if checkPlayServices is successful. The showErrorResolutionDialog parameter (default true) controls whether a dialog that helps to resolve an error is shown (only in case the error is user-resolvable). Some errors are user-resolvable (e.g. when Play Services are outdated, or disabled) while other errors cannot be resolved (e.g. when the phone doesn't ship Play Services at all - which is the case with some device vendors). Dialog screenshots Apple: Play Services are an Android-only concept and are not needed on Apple. Hence, the method always resolves with: { minRequiredVersion: -1, installedVersion: -1, } Web: resolves (with the same value as on Apple) when the Google Client Library is loaded, rejects otherwise. Example of showPlayServicesUpdateDialog() method await GoogleOneTapSignIn.showPlayServicesUpdateDialog(); ","version":null,"tagName":"h3"},{"title":"signIn","type":1,"pageTitle":"Modern Google sign in","url":"/docs/one-tap#signin","content":" signature: (params?: OneTapSignInParams) => Promise<OneTapResponse> Platform\tBehaviorAndroid\tAttempts to sign in user automatically, without interaction. Docs. Apple\tAttempts to restore a previous user sign-in without interaction. Docs. Web\tAttempts to sign in user automatically, without interaction. Docs. If none is found, presents a sign-in UI. Read below for web support. Returns a Promise that resolves with OneTapResponse or rejects in case of error. If there is no user that was previously signed in, the promise resolves with NoSavedCredentialFound object. In that case, you can call createAccount to start a flow to create a new account. You don't need to call signIn as a response to a user action - you can call it when your app starts or when suitable. UI screenshots Android\tiOS\tWebNo UI, no user interaction the first time. If user has signed up previously, they will see this: (no UI, no user interaction)\tThe prompt presented the first time: If user has signed in previously, they will see this: Example code snippet Example of calling the signIn() method import { GoogleOneTapSignIn, statusCodes, isErrorWithCode, isSuccessResponse, isNoSavedCredentialFoundResponse, } from '@react-native-google-signin/google-signin'; // Somewhere in your code const signIn = async () => { try { await GoogleOneTapSignIn.checkPlayServices(); const response = await GoogleOneTapSignIn.signIn(); if (isSuccessResponse(response)) { // read user's info console.log(response.data); } else if (isNoSavedCredentialFoundResponse(response)) { // Android and Apple only. // No saved credential found (user has not signed in yet, or they revoked access) // call `createAccount()` } } catch (error) { console.error(error); if (isErrorWithCode(error)) { switch (error.code) { case statusCodes.ONE_TAP_START_FAILED: // Android-only, you probably have hit rate limiting. // You can still call `presentExplicitSignIn` in this case. break; case statusCodes.PLAY_SERVICES_NOT_AVAILABLE: // Android: play services not available or outdated. // Get more details from `error.userInfo`. // Web: when calling an unimplemented api (requestAuthorization) // or when the Google Client Library is not loaded yet. break; default: // something else happened } } else { // an error that's not related to google sign in occurred } } }; ","version":null,"tagName":"h3"},{"title":"Utility Functions","type":1,"pageTitle":"Modern Google sign in","url":"/docs/one-tap#utility-functions","content":" tip There are 4 helper functions available: isErrorWithCode for processing errorsisSuccessResponse for checking if a response represents a successful operation. Same as checking response.type === 'success'.isNoSavedCredentialFoundResponse for checking if a response represents no saved credentials case. Same as checking response.type === 'noSavedCredentialFound'.isCancelledResponse for checking if a response represents user cancellation case. Same as checking response.type === 'cancelled'. ","version":null,"tagName":"h3"},{"title":"createAccount","type":1,"pageTitle":"Modern Google sign in","url":"/docs/one-tap#createaccount","content":" signature: (params?: OneTapCreateAccountParams) => Promise<OneTapResponse> Platform\tBehaviorAndroid\tStarts a flow to sign in with your app for the first time (to create a user account). It offers a list of user accounts to choose from (multiple Google accounts can be logged in on the device). Apple\tStarts an interactive sign-in flow. Docs. It offers a list of user accounts to choose from (multiple Google accounts can be logged in on the device). Web\tPresents a one-tap prompt and waits for user interaction (it will not sign in automatically). The prompt has a slightly different styling than with signIn (configrable via the context param). Read below for web support. You don't need to call createAccount as a response to a user action - you can call it some time after your app starts (Though keep in mind the way the dialog is presented on iOS might be inconvenient to users if they didn't ask for it) or when suitable. Use createAccount if signIn resolved with NoSavedCredentialFound result, as indicated in the code snippet above. Returns a Promise that resolves with OneTapResponse or rejects in case of error. UI screenshots Android\tiOS\tWeb await GoogleOneTapSignIn.createAccount({ nonce: 'your_nonce', // nonce is supported on all platforms! }); ","version":null,"tagName":"h3"},{"title":"presentExplicitSignIn","type":1,"pageTitle":"Modern Google sign in","url":"/docs/one-tap#presentexplicitsignin","content":" ✨since v14.2.0 signature: (params?: OneTapExplicitSignInParams) => Promise<OneTapExplicitSignInResponse> Platform\tBehaviorAndroid\tPresents the sign in dialog explicitly. This is useful when the user has hit rate limiting (ONE_TAP_START_FAILED) and the one-tap flow is thus not available, or if both signIn and createAccount resolve with NoSavedCredentialFound object - which happens (in the unlikely case) when no Google account is present on the device. This will prompt the user to add a Google account. Apple\tStarts an interactive sign-in flow. Same as createAccount. Web\tPresents a one-tap prompt. Same as createAccount. Preferably, call this method only as a reaction to when user taps a "sign in with Google" button. UI screenshots Android\tiOS\tWeb await GoogleOneTapSignIn.presentExplicitSignIn({ nonce: 'your_nonce', // nonce is supported on all platforms! }); ","version":null,"tagName":"h3"},{"title":"signOut","type":1,"pageTitle":"Modern Google sign in","url":"/docs/one-tap#signout","content":" signature: (emailOrUniqueId: string) => Promise<null> Signs out the current user. On the web, you need to provide the id or email of the user. On Android and Apple, this parameter does not have any effect. Returns a Promise that resolves with null or rejects in case of error. await GoogleOneTapSignIn.signOut(user.id); ","version":null,"tagName":"h3"},{"title":"requestAuthorization","type":1,"pageTitle":"Modern Google sign in","url":"/docs/one-tap#requestauthorization","content":" ✨since v15.0.0 signature: (params: RequestAuthorizationParams) => Promise<AuthorizationResponse> The underlying Android SDK separates authentication and authorization - that means that on Android you can request an access token and call Google APIs on behalf of the user without previously signing the user in. This method is used to request extra authorization from the user. Use this on Android to obtain server-side access (offline access) to the user's data or for requesting an access token that has access to additional scopes. Platform\tBehaviorAndroid\tPresents a modal that asks user for additional access to their Google account. Uses AuthorizationRequest.Builder. Apple\tCalls addScopes. The resulting accessToken has access to the requested scopes. Use this if you want to read more user metadata than just the basic info. Web\tNot implemented at the moment. There are minor differences between the Android and Apple implementations stemming from the underlying Google SDKs. For example, Apple returns all granted scopes, while Android may only return the scopes that were requested. UI screenshots Android\tiOS\t ","version":null,"tagName":"h3"},{"title":"Automatic webClientId & iosClientId detection","type":1,"pageTitle":"Modern Google sign in","url":"/docs/one-tap#automatic-config","content":" ✨since v15.2.0 for webClientId, 18.2.0 for iosClientId If you use Expo (with the config plugin and prebuild), or if you're using Firebase, you don't need to provide the iosClientId parameter to the configure method. Additionally, this module can automatically detect the webClientId from Firebase's configuration file (does not work on web where you need to provide it explicitly). This is useful if you're using Firebase and want to avoid manually setting the webClientId in your code, especially if you have multiple environments (e.g. staging, production). To use this feature: Add WEB_CLIENT_ID entry to the GoogleService-Info.plist file. On Android, the google-services.json file already contains the web client ID information. Unfortunately, it's not the case on iOS, so we need to add it ourselves. Open the GoogleService-Info.plist in your favorite text editor and add the following: <key>WEB_CLIENT_ID</key> <string>your-web-client-id.apps.googleusercontent.com</string> pass "autoDetect" as the webClientId parameter. tip As explained above, iosClientId can also be detected automatically - simply do not pass any iosClientId value. The reason webClientId is a required parameter is API uniformity across all platforms. ","version":null,"tagName":"h2"},{"title":"Web support","type":1,"pageTitle":"Modern Google sign in","url":"/docs/one-tap#web-support","content":" Providing a unified API across all platforms is a bit more tricky than it may seem. The web experience is different from the mobile one, and so are the underlying APIs. On the web, the GoogleOneTapSignIn sign in functions are not Promise-based but callback-based as seen below. That means they return void and you need to provide callbacks for success and error handling. Still, the parameter and result types are the same as for native, allowing to reuse the logic for both success and error handling across all platforms. note The implementation has been migrated to FedCM though you can disable this via use_fedcm_for_prompt parameter. To implement web support, follow these steps: Call GoogleOneTapSignIn.signIn upon page load. This attempts to present the One-tap UI. It also sets up a listener for authentication events and calls the onSuccess callback when the user signs in (either with the One-tap flow or the Sign-In button). If you do not want to present the one-tap UI, pass skipPrompt: true in the OneTapSignInParams object. This only sets up the listener for authentication events, and then relies on the user signing in via the WebGoogleSigninButton. warning You should display the One Tap UI on page load or other window events, instead of it being displayed by a user action (e.g. a button press). Otherwise, you may get a broken UX. Users may not see any UI after a user action, due to globally opt-out, cool-down, or no Google session. useEffect(() => { GoogleOneTapSignIn.configure({ webClientId, iosClientId: config.iosClientId, }); if (Platform.OS === 'web') { GoogleOneTapSignIn.signIn( { ux_mode: 'popup', }, { onResponse: (response) => { if (response.type === 'success') { console.log(response.data); } }, onError: (error) => { // handle error }, momentListener: (moment) => { console.log('moment', moment); }, }, ); } }, []); Optionally, you can provide a momentListener callback function. The callback is called when important events take place. See reference. Render the WebGoogleSigninButton component One-tap UI may not always be available: This happens if you disable it (skipPrompt), when user has opted out or when they cancel the prompt several times in a row, entering the cooldown period. WebGoogleSigninButton serves as a fallback. Tapping it opens the regular Google Sign-In dialog (or redirect, based on ux_mode param). When user signs in, the onResponse callback is called. info The reason the GoogleOneTapSignIn.signIn api is callback-based rather than promise-based is that it's possible to get into an "error" state (when one-tap is not available) and later get a successful sign in from the button flow. Because of how the Google Sign In for web SDK is done, modeling this with a promise-based api is not possible. ","version":null,"tagName":"h2"},{"title":"Obtaining configuration information","type":0,"sectionRef":"#","url":"/docs/setting-up/get-config-file","content":"","keywords":"","version":null},{"title":"Android","type":1,"pageTitle":"Obtaining configuration information","url":"/docs/setting-up/get-config-file#android","content":" Follow the 2 steps below to set up Google Sign In for your Android app. danger Completing this guide is crucial for Google Sign-In to work on Android. If not done correctly, you will get the infamous DEVELOPER_ERROR error (how to troubleshoot it). ","version":null,"tagName":"h2"},{"title":"Step 1: Obtain SHA-1 certificate fingerprints","type":1,"pageTitle":"Obtaining configuration information","url":"/docs/setting-up/get-config-file#step-1-obtain-sha-1-certificate-fingerprints","content":" You probably use multiple signing configurations for your Android app - for example for building debug and release APKs locally or building on Expo EAS. Then there's the Play App Signing for store deployments - while the Google Play Store does not rebuild your app, it may re-sign it using one of its own signing configurations. First, you need to obtain the SHA-1 certificate fingerprints for all of these signing configurations using the instructions below. Then, use all of those SHA-1 hashes in Step 2 below. When using Expo EASWhen developing locallyWhen releasing via Google Play Store If you use Expo EAS, run eas credentials to obtain the Keystore information, which includes the SHA-1 fingerprint. See EAS credentials docs to learn more. ","version":null,"tagName":"h3"},{"title":"Step 2: Add SHA-1 hashes to Firebase or Google Cloud Console","type":1,"pageTitle":"Obtaining configuration information","url":"/docs/setting-up/get-config-file#step-2","content":" Using all of the SHA-1 fingerprints obtained in the previous step, follow the instructions below. When using FirebaseWhen not using Firebase Sign in to Firebase and open your project.Ensure that in the "Authentication" menu, "Google" is enabled as "Sign-in method".Click the Settings icon and select Project settings.In the "Your apps" card, select the app you need to add SHA-1 to.Click "Add fingerprint".Check that "Package name" is correct.Download the google-services.json file. ","version":null,"tagName":"h3"},{"title":"iOS","type":1,"pageTitle":"Obtaining configuration information","url":"/docs/setting-up/get-config-file#ios","content":" Read below on how to set up Google Sign In for your iOS app. When using FirebaseWhen not using Firebase Sign in to Firebase Console and open your project.Click the settings icon and go to "Project settings".Scroll down to "Your apps" section, and select the app.Check that "Bundle ID" is correct.Download the GoogleService-Info.plist file. ","version":null,"tagName":"h2"},{"title":"Web Client ID (optional)","type":1,"pageTitle":"Obtaining configuration information","url":"/docs/setting-up/get-config-file#web-client-id-optional","content":" For some use cases (offline support, web support), a Web Client ID is needed (provided to the configure() call). To obtain a Web Client ID, go to Google Cloud Console and find an existing one (it may be already created by Firebase) or create a new OAuth Client ID of type Web. ","version":null,"tagName":"h2"},{"title":"Expo setup","type":0,"sectionRef":"#","url":"/docs/setting-up/expo","content":"","keywords":"","version":null},{"title":"Prepare your Expo project","type":1,"pageTitle":"Expo setup","url":"/docs/setting-up/expo#prepare-your-expo-project","content":" info With Expo SDK 50, minimum iOS version was bumped to 13.4. In case you get an error during pod install step, see these release notes to determine the right version of this package to install. note This package cannot be used in Expo Go because it requires custom native code. However, you can add custom native code to an Expo app by using a development build. Using a development build is the recommended approach for production apps, and is documented in this guide. npx expo install @react-native-google-signin/google-signin ","version":null,"tagName":"h2"},{"title":"Add config plugin","type":1,"pageTitle":"Expo setup","url":"/docs/setting-up/expo#add-config-plugin","content":" After installing the npm package, add a config plugin (read more details below) to the plugins array of your app.json or app.config.js. There are 2 config plugins available: for projects with Firebase, and without Firebase. ","version":null,"tagName":"h2"},{"title":"Expo without Firebase","type":1,"pageTitle":"Expo setup","url":"/docs/setting-up/expo#expo-without-firebase","content":" If you're not using Firebase, provide the iosUrlScheme option to the config plugin. To obtain iosUrlScheme, follow the guide. app.json | js { "expo": { "plugins": [ [ "@react-native-google-signin/google-signin", { "iosUrlScheme": "com.googleusercontent.apps._some_id_here_" } ] ] } } ","version":null,"tagName":"h3"},{"title":"Expo and Firebase Authentication","type":1,"pageTitle":"Expo setup","url":"/docs/setting-up/expo#expo-and-firebase-authentication","content":" If you are using Firebase Authentication, obtain the 2 Firebase config files (google-services.json for Android and GoogleService-Info.plist for iOS) according to the guide and place them into your project. Then specify the paths to the files: app.json | js { "expo": { "plugins": ["@react-native-google-signin/google-signin"], "android": { "googleServicesFile": "./google-services.json" }, "ios": { "googleServicesFile": "./GoogleService-Info.plist" } } } ","version":null,"tagName":"h3"},{"title":"Rebuild the app","type":1,"pageTitle":"Expo setup","url":"/docs/setting-up/expo#rebuild-the-app","content":" Then run the following to generate the native project directories. Run this command every time you add or update any dependency with native code. npx expo prebuild --clean Next, rebuild your app and you're good to go! npx expo run:android && npx expo run:ios ","version":null,"tagName":"h2"},{"title":"API reference","type":0,"sectionRef":"#","url":"/docs/api","content":"","keywords":"","version":null},{"title":"Modern sign in module","type":1,"pageTitle":"API reference","url":"/docs/api#modern-sign-in-module","content":" ","version":null,"tagName":"h2"},{"title":"AuthorizationResponse","type":1,"pageTitle":"API reference","url":"/docs/api#authorizationresponse","content":" AuthorizationResponse: CancelledResponse | AuthorizationSuccessResponse The response object of requestAuthorization. Either the user cancelled the flow or they successfully gave authorization. ","version":null,"tagName":"h3"},{"title":"AuthorizationSuccessResponse","type":1,"pageTitle":"API reference","url":"/docs/api#authorizationsuccessresponse","content":" AuthorizationSuccessResponse: {data: {accessToken: string;grantedScopes: string[];serverAuthCode: string | null; };type: "success"; } An object that contains an access token that has access to the grantedScopes. It contains also the serverAuthCode if offlineAccess was requested. On iOS, you can also obtain serverAuthCode by calling createAccount() with offlineAccess: true. Type declaration Name\tTypedata\t{accessToken: string;grantedScopes: string[];serverAuthCode: string | null; } data.accessToken\tstring data.grantedScopes\tstring[] data.serverAuthCode\tstring | null type\t"success" ","version":null,"tagName":"h3"},{"title":"EnableAppCheckParams","type":1,"pageTitle":"API reference","url":"/docs/api#enableappcheckparams","content":" EnableAppCheckParams: {debugProviderAPIKey: string; } Parameters for enabling App Check. Provide debugProviderAPIKey to enable App Check with debug provider. Type declaration Name\tTypedebugProviderAPIKey?\tstring ","version":null,"tagName":"h3"},{"title":"OneTapConfigureParams","type":1,"pageTitle":"API reference","url":"/docs/api#onetapconfigureparams","content":" OneTapConfigureParams: ClientIdOrPlistPath & {hostedDomain: string;logLevel: "debug" | "info" | "warn";offlineAccess: boolean;openIdRealm: string;profileImageSize: number;scopes: string[];webClientId: WebClientId; } webClientId is the most important parameter in the configuration. It is required. Type declaration Name\tType\tDescriptionhostedDomain?\tstring\tiOS only. Specifies a hosted domain restriction. By setting this, authorization will be restricted to accounts of the user in the specified domain. logLevel?\t"debug" | "info" | "warn"\tWeb only. Controls debug logging in browser console. This is implemented in Google's web SDK and is not part of their public API so it may change or be removed at any time. offlineAccess?\tboolean\tiOS only. Use requestAuthorization on Android. Must be true if you wish to access user APIs on behalf of the user from your own server. When offline access is requested, an authorization code is returned so the server can use the authorization code to exchange for a refresh token. The refresh token allows the server to access Google data on behalf of the user. Default false openIdRealm?\tstring\tiOS only. The OpenID2 realm of the home web server. This allows Google to include the user's OpenID Identifier in the OpenID Connect ID token. profileImageSize?\tnumber\tiOS only. The desired height and width of the profile image. Default 120px scopes?\tstring[]\tiOS only. The Google API scopes to request access to. Use requestAuthorization to request additional scopes on Android. Default ["email", "profile"] webClientId\tWebClientId\tThe web client ID obtained from Google Cloud console. In the Modern module only, pass autoDetect to automatically determine the value from Firebase config file. ","version":null,"tagName":"h3"},{"title":"OneTapCreateAccountParams","type":1,"pageTitle":"API reference","url":"/docs/api#onetapcreateaccountparams","content":" OneTapCreateAccountParams: OneTapSignInParams & {accountName: string;requestVerifiedPhoneNumber: boolean; } Type declaration Name\tType\tDescriptionaccountName?\tstring\tiOS only. An account name present on the device that should be used. Example [email protected] requestVerifiedPhoneNumber?\tboolean\tAndroid only. Whether to request for a verified phone number during sign-ups. Requesting it doesn't guarantee that it will be provided in the response. Default false ","version":null,"tagName":"h3"},{"title":"OneTapExplicitSignInParams","type":1,"pageTitle":"API reference","url":"/docs/api#onetapexplicitsigninparams","content":" OneTapExplicitSignInParams: OneTapSignInParams & {accountName: string; } Type declaration Name\tType\tDescriptionaccountName?\tstring\tiOS only. An account name present on the device that should be used. Example [email protected] ","version":null,"tagName":"h3"},{"title":"OneTapExplicitSignInResponse","type":1,"pageTitle":"API reference","url":"/docs/api#onetapexplicitsigninresponse","content":" OneTapExplicitSignInResponse: OneTapSuccessResponse | CancelledResponse ","version":null,"tagName":"h3"},{"title":"OneTapResponse","type":1,"pageTitle":"API reference","url":"/docs/api#onetapresponse","content":" OneTapResponse: OneTapSuccessResponse | CancelledResponse | NoSavedCredentialFound The response object for OneTap's signIn and createAccount. ","version":null,"tagName":"h3"},{"title":"OneTapSignInParams","type":1,"pageTitle":"API reference","url":"/docs/api#onetapsigninparams","content":" OneTapSignInParams: {nonce: string;skipPrompt: boolean; } & ReducedWebSignInOptions Learn more about additional web-only parameters at Google's reference documentation. Type declaration Name\tType\tDescriptionnonce?\tstring\tA cryptographically random value used to mitigate replay attacks. Supported on all platforms. skipPrompt?\tboolean\tWeb only. When calling any of the sign-in methods, a prompt is displayed by default on the top-right of the web page. Set this to true to only allow signing in via the WebGoogleSigninButton. Default false ","version":null,"tagName":"h3"},{"title":"OneTapSuccessResponse","type":1,"pageTitle":"API reference","url":"/docs/api#onetapsuccessresponse","content":" OneTapSuccessResponse: {data: OneTapUser;type: "success"; } The response object when the user successfully signs in. Type declaration Name\tTypedata\tOneTapUser type\t"success" ","version":null,"tagName":"h3"},{"title":"OneTapUser","type":1,"pageTitle":"API reference","url":"/docs/api#onetapuser","content":" OneTapUser: {credentialOrigin: CredentialResponse["select_by"];idToken: string;serverAuthCode: string | null;user: {email: string | null;familyName: string | null;givenName: string | null;id: string;name: string | null;phoneNumber: string | null;photo: string | null; }; } Type declaration Name\tType\tDescriptioncredentialOrigin\tCredentialResponse["select_by"]\tThe credential origin. This is the method that was used to sign in the user. On native platforms, this is always "user". On the web it's a value from a union type. idToken\tstring\t- serverAuthCode\tstring | null\tiOS only. Not null only if a valid webClientId and offlineAccess: true was specified in configure(). Call requestAuthorization() to obtain it on Android. user\t{email: string | null;familyName: string | null;givenName: string | null;id: string;name: string | null;phoneNumber: string | null;photo: string | null; }\t- user.email\tstring | null\t- user.familyName\tstring | null\t- user.givenName\tstring | null\t- user.id\tstring\t- user.name\tstring | null\t- user.phoneNumber\tstring | null\tAndroid only, and only for createAccount. Requires setting requestVerifiedPhoneNumber to true. user.photo\tstring | null\t- ","version":null,"tagName":"h3"},{"title":"PlayServicesInfo","type":1,"pageTitle":"API reference","url":"/docs/api#playservicesinfo","content":" PlayServicesInfo: {installedVersion: number;minRequiredVersion: number; } The response object for successful checkPlayServices call. It denotes that the necessary prerequisites for calling the module in methods are met. Type declaration Name\tTypeinstalledVersion\tnumber minRequiredVersion\tnumber ","version":null,"tagName":"h3"},{"title":"RequestAuthorizationParams","type":1,"pageTitle":"API reference","url":"/docs/api#requestauthorizationparams","content":" RequestAuthorizationParams: {accountName: string;hostedDomain: string;offlineAccess: {enabled: boolean;forceCodeForRefreshToken: boolean; };scopes: string[]; } Learn more in the guide. Type declaration Name\tType\tDescriptionaccountName?\tstring\tAndroid only. Specifies an account on the device that should be used. hostedDomain?\tstring\tAndroid only. Specifies a hosted domain restriction. By setting this, authorization will be restricted to accounts of the user in the specified domain. offlineAccess?\t{enabled: boolean;forceCodeForRefreshToken: boolean; }\t- offlineAccess.enabled\tboolean\tWhether to enable offline access. If enabled, serverAuthCode will be returned in the response. offlineAccess.forceCodeForRefreshToken?\tboolean\tAndroid only. If true, the granted code can be exchanged for an access token and a refresh token. Only use true if your server has suffered some failure and lost the user's refresh token. scopes\tstring[]\tThe Google API scopes to request access to. See scopes docs. ","version":null,"tagName":"h3"},{"title":"GoogleOneTapSignIn","type":1,"pageTitle":"API reference","url":"/docs/api#googleonetapsignin","content":" const GoogleOneTapSignIn: complex type, see below The entry point of the Modern Sign In API, exposed as GoogleOneTapSignIn. On the web, the signatures of signIn, presentExplicitSignIn, and createAccount are callback-based and on native they are Promise-based. Read more in the guide. Type declaration Name\tTypeconfigure\t(params: OneTapConfigureParams) => void checkPlayServices\t(showErrorResolutionDialog?: boolean) => Promise<PlayServicesInfo> enableAppCheck\t(params?: EnableAppCheckParams) => Promise<null> signIn\t(params?: OneTapSignInParams) => Promise<OneTapResponse> createAccount\t(params?: OneTapCreateAccountParams) => Promise<OneTapResponse> presentExplicitSignIn\t(params?: OneTapExplicitSignInParams) => Promise<OneTapExplicitSignInResponse> requestAuthorization\t(options: RequestAuthorizationParams) => Promise<AuthorizationResponse> signOut\t(emailOrUniqueId: string) => Promise<null> ","version":null,"tagName":"h3"},{"title":"Original Google sign in","type":1,"pageTitle":"API reference","url":"/docs/api#original-google-sign-in","content":" ","version":null,"tagName":"h2"},{"title":"AddScopesParams","type":1,"pageTitle":"API reference","url":"/docs/api#addscopesparams","content":" AddScopesParams: {scopes: string[]; } Type declaration Name\tType\tDescriptionscopes\tstring[]\tThe Google API scopes to request access to. Default ["email", "profile"] ","version":null,"tagName":"h3"},{"title":"ConfigureParams","type":1,"pageTitle":"API reference","url":"/docs/api#configureparams","content":" ConfigureParams: ClientIdOrPlistPath & {accountName: string;forceCodeForRefreshToken: boolean;hostedDomain: string;offlineAccess: boolean;openIdRealm: string;profileImageSize: number;scopes: string[];webClientId: WebClientId; } Type declaration Name\tType\tDescriptionaccountName?\tstring\tAndroid only. An account name that should be prioritized. forceCodeForRefreshToken?\tboolean\tAndroid only. Only set to true if your server has suffered some failure and lost the user's refresh token. hostedDomain?\tstring\tSpecifies a hosted domain restriction. By setting this, authorization will be restricted to accounts of the user in the specified domain. offlineAccess?\tboolean\tMust be true if you wish to access user APIs on behalf of the user from your own server. When offline access is requested, an authorization code is returned so the server can use the authorization code to exchange for access token and refresh token. The access token allows the server to access Google data on behalf of the user. openIdRealm?\tstring\tiOS only. The OpenID2 realm of the home web server. This allows Google to include the user's OpenID Identifier in the OpenID Connect ID token. profileImageSize?\tnumber\tiOS only. The desired height and width of the profile image. Default 120px scopes?\tstring[]\tThe Google API scopes to request access to. Default ["email", "profile"] webClientId?\tWebClientId\tThe web client ID obtained from Google Cloud console. Required for offline access. ","version":null,"tagName":"h3"},{"title":"GetTokensResponse","type":1,"pageTitle":"API reference","url":"/docs/api#gettokensresponse","content":" GetTokensResponse: {accessToken: string;idToken: string; } Type declaration Name\tTypeaccessToken\tstring idToken\tstring ","version":null,"tagName":"h3"},{"title":"HasPlayServicesParams","type":1,"pageTitle":"API reference","url":"/docs/api#hasplayservicesparams","content":" HasPlayServicesParams: {showPlayServicesUpdateDialog: boolean; } Type declaration Name\tType\tDescriptionshowPlayServicesUpdateDialog?\tboolean\tWhether to show a dialog that prompts the user to install Google Play Services, if they don't have them installed. Default true ","version":null,"tagName":"h3"},{"title":"SignInParams","type":1,"pageTitle":"API reference","url":"/docs/api#signinparams","content":" SignInParams: {loginHint: string;nonce: string; } Type declaration Name\tType\tDescriptionloginHint?\tstring\tiOS only. The user's ID, or email address, to be prefilled in the authentication UI if possible. See docs here. nonce?\tstring\tiOS only. A cryptographically random value used to mitigate replay attacks. Currently only available for sponsors. For support across all platforms, use the Modern sign in module. ","version":null,"tagName":"h3"},{"title":"SignInResponse","type":1,"pageTitle":"API reference","url":"/docs/api#signinresponse","content":" SignInResponse: SignInSuccessResponse | CancelledResponse ","version":null,"tagName":"h3"},{"title":"SignInSilentlyResponse","type":1,"pageTitle":"API reference","url":"/docs/api#signinsilentlyresponse","content":" SignInSilentlyResponse: SignInSuccessResponse | NoSavedCredentialFound The response object for calling signInSilently. Either the user details are available (without user interaction) or there was no saved credential found. ","version":null,"tagName":"h3"},{"title":"SignInSuccessResponse","type":1,"pageTitle":"API reference","url":"/docs/api#signinsuccessresponse","content":" SignInSuccessResponse: {data: User;type: "success"; } The response object when the user signs in successfully. Type declaration Name\tType\tDescriptiondata\tUser\tThe user details. type\t"success"\t- ","version":null,"tagName":"h3"},{"title":"User","type":1,"pageTitle":"API reference","url":"/docs/api#user","content":" User: {idToken: string | null;scopes: string[];serverAuthCode: string | null;user: {email: string;familyName: string | null;givenName: string | null;id: string;name: string | null;photo: string | null; }; } Type declaration Name\tType\tDescriptionidToken\tstring | null\tJWT (JSON Web Token) that serves as a secure credential for your user's identity. scopes\tstring[]\tThe Google API scopes that the user granted access to. serverAuthCode\tstring | null\tCode that you can securely send to your server to exchange for an access and refresh token. Use the access token to call Google APIs on behalf of the user and, optionally, store the refresh token to acquire a new access token when the access token expires. Not null only if a valid webClientId and offlineAccess was enabled in configure(). user\t{email: string;familyName: string | null;givenName: string | null;id: string;name: string | null;photo: string | null; }\t- user.email\tstring\t- user.familyName\tstring | null\t- user.givenName\tstring | null\t- user.id\tstring\t- user.name\tstring | null\t- user.photo\tstring | null\t- ","version":null,"tagName":"h3"},{"title":"GoogleSignin","type":1,"pageTitle":"API reference","url":"/docs/api#googlesignin","content":" const GoogleSignin: complex type, see below The entry point of the Google Sign In API, exposed as GoogleSignin. Type declaration Name\tTypeaddScopes\t(options: AddScopesParams) => Promise<SignInResponse | null> clearCachedAccessToken\t(tokenString: string) => Promise<null> configure\t(options?: ConfigureParams) => void enableAppCheck\t(params?: EnableAppCheckParams) => Promise<null> getCurrentUser\t() => User | null getTokens\t() => Promise<GetTokensResponse> hasPlayServices\t(options?: HasPlayServicesParams) => Promise<boolean> hasPreviousSignIn\t() => boolean revokeAccess\t() => Promise<null> signIn\t(options: SignInParams) => Promise<SignInResponse> signInSilently\t() => Promise<SignInSilentlyResponse> signOut\t() => Promise<null> ","version":null,"tagName":"h3"},{"title":"Constants","type":1,"pageTitle":"API reference","url":"/docs/api#constants","content":" ","version":null,"tagName":"h2"},{"title":"statusCodes","type":1,"pageTitle":"API reference","url":"/docs/api#statuscodes","content":" const statusCodes: Readonly<{IN_PROGRESS: string;ONE_TAP_START_FAILED: string;PLAY_SERVICES_NOT_AVAILABLE: string; }> Read more about the meaning of the error codes in the guide. Type declaration Name\tTypeIN_PROGRESS\tstring ONE_TAP_START_FAILED\tstring PLAY_SERVICES_NOT_AVAILABLE\tstring ","version":null,"tagName":"h3"},{"title":"Functions","type":1,"pageTitle":"API reference","url":"/docs/api#functions","content":" ","version":null,"tagName":"h2"},{"title":"isCancelledResponse()","type":1,"pageTitle":"API reference","url":"/docs/api#iscancelledresponse","content":" isCancelledResponse(response: OneTapResponse): response is CancelledResponse TypeScript helper to check if a response is a cancelled response. This is the same as checking if the response.type === "cancelled". Use this if you prefer to use a function instead of comparing with a raw string. It supports both One Tap and Original Google Sign In responses. Parameters Parameter\tTyperesponse\tOneTapResponse Returns response is CancelledResponse Example const response = await GoogleOneTapSignIn.createAccount(); if (isCancelledResponse(response)) { // handle cancelled response } ","version":null,"tagName":"h3"},{"title":"isErrorWithCode()","type":1,"pageTitle":"API reference","url":"/docs/api#iserrorwithcode","content":" isErrorWithCode(error: any): error is NativeModuleError TypeScript helper to check if an object has the code property. This is used to avoid as casting when you access the code property on errors returned by the module. Parameters Parameter\tTypeerror\tany Returns error is NativeModuleError ","version":null,"tagName":"h3"},{"title":"isNoSavedCredentialFoundResponse()","type":1,"pageTitle":"API reference","url":"/docs/api#isnosavedcredentialfoundresponse","content":" isNoSavedCredentialFoundResponse(response: OneTapResponse): response is NoSavedCredentialFound TypeScript helper to check if a response is a noSavedCredentialFound response. This is the same as checking if the response.type === "noSavedCredentialFound". Use this if you prefer to use a function instead of comparing with a raw string. It supports both One Tap and Original Google Sign In responses. Parameters Parameter\tTyperesponse\tOneTapResponse Returns response is NoSavedCredentialFound Example const response = await GoogleOneTapSignIn.signIn(); if (isNoSavedCredentialFoundResponse(response)) { // the case when no user was previously signed in } ","version":null,"tagName":"h3"},{"title":"isSuccessResponse()","type":1,"pageTitle":"API reference","url":"/docs/api#issuccessresponse","content":" isSuccessResponse(response: OneTapResponse): response is OneTapSuccessResponse TypeScript helper to check if a response is a cancelled response. This is the same as checking if the response.type === "cancelled". Use this if you prefer to use a function instead of comparing with a raw string. It supports both One Tap and Original Google Sign In responses. Parameters Parameter\tTyperesponse\tOneTapResponse Returns response is OneTapSuccessResponse Example const response = await GoogleOneTapSignIn.createAccount(); if (isSuccessResponse(response)) { // handle user signed in } ","version":null,"tagName":"h3"},{"title":"React Components","type":1,"pageTitle":"API reference","url":"/docs/api#react-components","content":" ","version":null,"tagName":"h2"},{"title":"GoogleSigninButtonProps","type":1,"pageTitle":"API reference","url":"/docs/api#googlesigninbuttonprops","content":" GoogleSigninButtonProps: ViewProps & {color: "dark" | "light";disabled: boolean;onPress: () => void;size: number; } Type declaration Name\tTypecolor?\t"dark" | "light" disabled?\tboolean onPress?\t() => void size?\tnumber ","version":null,"tagName":"h3"},{"title":"WebGoogleSignInButtonProps","type":1,"pageTitle":"API reference","url":"/docs/api#webgooglesigninbuttonprops","content":" WebGoogleSignInButtonProps: Omit<GsiButtonConfiguration, "logo_alignment"> & {logoAlignment: GsiButtonConfiguration["logo_alignment"];onError: (error: Error) => void; } Type declaration Name\tTypelogoAlignment?\tGsiButtonConfiguration["logo_alignment"] onError?\t(error: Error) => void ","version":null,"tagName":"h3"},{"title":"GoogleSigninButton()","type":1,"pageTitle":"API reference","url":"/docs/api#googlesigninbutton","content":" GoogleSigninButton(props: GoogleSigninButtonProps): Element Parameters Parameter\tTypeprops\tGoogleSigninButtonProps Returns Element ","version":null,"tagName":"h3"},{"title":"WebGoogleSigninButton()","type":1,"pageTitle":"API reference","url":"/docs/api#webgooglesigninbutton","content":" WebGoogleSigninButton(props: WebGoogleSignInButtonProps): Element Parameters Parameter\tTypeprops\tWebGoogleSignInButtonProps Returns Element ","version":null,"tagName":"h3"},{"title":"Type Aliases","type":1,"pageTitle":"API reference","url":"/docs/api#type-aliases","content":" ","version":null,"tagName":"h2"},{"title":"CancelledResponse","type":1,"pageTitle":"API reference","url":"/docs/api#cancelledresponse","content":" CancelledResponse: {data: null;type: "cancelled"; } The response object when the user cancels the flow for any operation that requires user interaction. On the web, this is also returned while cooldown period is active. Detecting the cooldown period itself is not possible on the web for user privacy reasons. On Android, it can be detected via ONE_TAP_START_FAILED Type declaration Name\tTypedata\tnull type\t"cancelled" ","version":null,"tagName":"h3"},{"title":"ClientIdOrPlistPath","type":1,"pageTitle":"API reference","url":"/docs/api#clientidorplistpath","content":" ClientIdOrPlistPath: {iosClientId: string; } | {googleServicePlistPath: string; } iOS only. Configures the iOS client ID. By default, the iOS client ID is taken from the GoogleService-Info.plist Firebase config file (if present). You can specify a different bundle path for the config file, e.g. "GoogleService-Info-Staging". Alternatively, set the client ID explicitly by providing iosClientId. ","version":null,"tagName":"h3"},{"title":"NoSavedCredentialFound","type":1,"pageTitle":"API reference","url":"/docs/api#nosavedcredentialfound","content":" NoSavedCredentialFound: {data: null;type: "noSavedCredentialFound"; } The response to calling One Tap's signIn and Original Google Sign In's signInSilently when no user was previously signed in, or they have since signed out or revoked access. Type declaration Name\tTypedata\tnull type\t"noSavedCredentialFound" ","version":null,"tagName":"h3"},{"title":"Web Modern sign in module","type":1,"pageTitle":"API reference","url":"/docs/api#web-modern-sign-in-module","content":" ","version":null,"tagName":"h2"},{"title":"WebOneTapSignInCallbacks","type":1,"pageTitle":"API reference","url":"/docs/api#webonetapsignincallbacks","content":" WebOneTapSignInCallbacks: {momentListener: MomentListener;onError: (error: NativeModuleError) => void | Promise<void>;onResponse: (userInfo: OneTapExplicitSignInResponse) => void | Promise<void>; } When using Modern sign in on the web, the sign in result is delivered via a callback, not via a promise. The shape of data delivered to the callback is the same as the shape of the data in the promise, enabling code reuse. Read more in the guide. Type declaration Name\tType\tDescriptionmomentListener?\tMomentListener\tA callback function that is called when important events take place. See reference. onError\t(error: NativeModuleError) => void | Promise<void>\tCalled when an error occurs. You can use the code property of the error to determine the reason for the error. The reported errors on the web are in the same format as the errors reported on the native platforms, so you can reuse your error handling code. onResponse\t(userInfo: OneTapExplicitSignInResponse) => void | Promise<void>\tCalled when the user successfully signs in, or cancels the sign in, either using the web One-tap flow or the button flow. ","version":null,"tagName":"h3"},{"title":"Web setup guide","type":0,"sectionRef":"#","url":"/docs/setting-up/web","content":"Web setup guide On the web, there is one extra step necessary to use the library: you need to load the Google Client Library and make it available in the browser before calling any of the APIs exposed by this package. tip Web support is only available to sponsors️. It takes just a few clicks to get access ❤️. There are different ways to load the client script. Some of them are: Next.jsSimple htmluseEffect import Script from 'next/script'; <Script src="https://accounts.google.com/gsi/client" strategy="lazyOnload" onLoad={() => { // present the sign in popup }} />; After the script is loaded, you can call the functions for signing in and render the WebGoogleSigninButton. If you call any of the module functions before the client library is loaded, such calls trigger the onError callback with the PLAY_SERVICES_NOT_AVAILABLE error code. You can read the official docs for loading the Client Library here.","keywords":"","version":null},{"title":"FAQ / Troubleshooting","type":0,"sectionRef":"#","url":"/docs/troubleshooting","content":"","keywords":"","version":null},{"title":"Android","type":1,"pageTitle":"FAQ / Troubleshooting","url":"/docs/troubleshooting#android","content":" ","version":null,"tagName":"h2"},{"title":"Login does not work when downloading from the Play Store.","type":1,"pageTitle":"FAQ / Troubleshooting","url":"/docs/troubleshooting#login-does-not-work-when-downloading-from-the-play-store","content":" See the next paragraph. ","version":null,"tagName":"h3"},{"title":"DEVELOPER_ERROR or code: 10 or Developer console is not set up correctly error message","type":1,"pageTitle":"FAQ / Troubleshooting","url":"/docs/troubleshooting#developer_error","content":" This is always (!always!) a configuration mismatch between your app and the server-side setup (in Firebase or Google Cloud console). Follow these pointers: Make sure that your SHA-1 (NOT SHA-256!) certificate fingerprints and Android package name you entered in Firebase Console / Google Cloud Console are correct.Add the SHA-1 from the output of this command to your Firebase / Google Cloud Console. You should be able to recognize the SHA-1 - do not add a hash if you're not sure of its origin.Follow the setup guide and perform its steps once again.Search the issue tracker for old reports of the error.If you're passing webClientId in the configuration object to GoogleSignin.configure(), make sure it's correct and that it is of type web (NOT Android!). You can get your webClientId from Google Developer Console. It is listed under "OAuth 2.0 client IDs".If you are using Firebase, you need to add Google as a Sign-in method in Firebase itself (Build -> Authentication -> Sign-in method). If you have already created an app, you will be prompted for fingerprints and then you will get a new google-services.json which you need to use in your app instead of the old one. ","version":null,"tagName":"h3"},{"title":"Login does not work when using Internal App Sharing.","type":1,"pageTitle":"FAQ / Troubleshooting","url":"/docs/troubleshooting#login-does-not-work-when-using-internal-app-sharing","content":" If you get a DEVELOPER_ERROR when using Internal App Sharing, it is because Google resigns your application with its own key. See the previous paragraph. ","version":null,"tagName":"h3"},{"title":"\"A non-recoverable sign in failure occurred\"","type":1,"pageTitle":"FAQ / Troubleshooting","url":"/docs/troubleshooting#a-non-recoverable-sign-in-failure-occurred","content":" See this comment. Or this SO question. ","version":null,"tagName":"h3"},{"title":"Changing play-services-auth version","type":1,"pageTitle":"FAQ / Troubleshooting","url":"/docs/troubleshooting#changing-play-services-auth-version","content":" See "Choose Dependency versions" above. ","version":null,"tagName":"h3"},{"title":"Package name !== application id","type":1,"pageTitle":"FAQ / Troubleshooting","url":"/docs/troubleshooting#package-name--application-id","content":" When adding a new oauth client, google asks you to add your package name. In some cases your package name is not equal to your application id. Check if your package name in the AndroidManifest.xml is the same as your application/bundle id. Find your application id in the play console or android/app/build.gradle. The format looks like com.yourapp.id. ","version":null,"tagName":"h3"},{"title":"iOS","type":1,"pageTitle":"FAQ / Troubleshooting","url":"/docs/troubleshooting#ios","content":" ","version":null,"tagName":"h2"},{"title":"On iOS the app crashes when tapping Sign In button","type":1,"pageTitle":"FAQ / Troubleshooting","url":"/docs/troubleshooting#on-ios-the-app-crashes-when-tapping-sign-in-button","content":" Along with "Your app is missing support for the following URL schemes" error in console. Your Url Schemes configuration is incorrect. If you use Expo, make sure that the config plugin is configured correctly. In vanilla React Native projects, add URL type like this. ","version":null,"tagName":"h3"},{"title":"iOS setup guide","type":0,"sectionRef":"#","url":"/docs/setting-up/ios","content":"","keywords":"","version":null},{"title":"Link the native module","type":1,"pageTitle":"iOS setup guide","url":"/docs/setting-up/ios#link-the-native-module","content":" run pod install in ios/ directory to install the module ","version":null,"tagName":"h3"},{"title":"Google project configuration","type":1,"pageTitle":"iOS setup guide","url":"/docs/setting-up/ios#google-project-configuration","content":" Follow this guide to get the configuration information which you need for the next steps. ","version":null,"tagName":"h3"},{"title":"Firebase Authentication","type":1,"pageTitle":"iOS setup guide","url":"/docs/setting-up/ios#firebase-authentication","content":" If you're using Firebase Authentication, download the GoogleService-Info.plist file and place it into your Xcode project. ","version":null,"tagName":"h3"},{"title":"Xcode configuration","type":1,"pageTitle":"iOS setup guide","url":"/docs/setting-up/ios#xcode-configuration","content":" Configure URL types in the Info panel (see screenshot) add your "iOS URL scheme" (also known as reversed client id), which can be found in Google Cloud Console under your iOS client ID. If you need to support Mac Catalyst, you will need to enable the Keychain Sharing capability on each build target. No keychain groups need to be added. ","version":null,"tagName":"h3"},{"title":"Rebuild the native project","type":1,"pageTitle":"iOS setup guide","url":"/docs/setting-up/ios#rebuild-the-native-project","content":" Do not forget to rebuild the native app after the setup is done. ","version":null,"tagName":"h2"},{"title":"Optional: modify your app to respond to the URL scheme","type":1,"pageTitle":"iOS setup guide","url":"/docs/setting-up/ios#optional-modify-your-app-to-respond-to-the-url-scheme","content":" This is only required if you have multiple listeners for openURL - for instance if you have both Google and Facebook OAuth (as seen in the code snippet below). Because only one openURL method can be defined, if you have multiple listeners for openURL, you must combine them into a single function in your AppDelegate.m like so: Open AppDelegate.mAdd an import: #import <GoogleSignIn/GoogleSignIn.h>Add a method to respond to the URL scheme. This is just an example of a method that you can add at the bottom of your file if you're using both FBSDKApplicationDelegate and GIDSignIn : // AppDelegate.m - (BOOL)application:(UIApplication *)application openURL:(nonnull NSURL *)url options:(nonnull NSDictionary<NSString *,id> *)options { return [[FBSDKApplicationDelegate sharedInstance] application:application openURL:url options:options] || [GIDSignIn.sharedInstance handleURL:url]; } ","version":null,"tagName":"h3"}],"options":{"disableVersioning":true,"excludeRoutes":["/docs/license"],"id":"default"}}