-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch-doc.json
More file actions
1 lines (1 loc) · 98.6 KB
/
Copy pathsearch-doc.json
File metadata and controls
1 lines (1 loc) · 98.6 KB
1
{"searchDocs":[{"title":"API reference","type":0,"sectionRef":"#","url":"/docs/api","content":"","keywords":"","version":null},{"title":"Universal sign in module","type":1,"pageTitle":"API reference","url":"/docs/api#universal-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(). Properties Property\tType data\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. Properties Property\tType debugProviderAPIKey?\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"; 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. 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 Universal 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 your_email@gmail.com 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 your_email@gmail.com ","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. Properties Property\tType data\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; }; } Properties Property\tType\tDescription credentialOrigin\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\tAn immutable identifier for the user. Unique among all Google accounts and never reused (user's email can change, this value cannot). 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. Properties Property\tType installedVersion\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; }; prompt?: AuthorizationPrompt | AuthorizationPrompt[]; scopes: string[]; } Learn more in the guide. Properties Property\tType\tDescription accountName?\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. Deprecated Use prompt: 'consent' instead. prompt?\tAuthorizationPrompt | AuthorizationPrompt[]\tAndroid only. Controls the prompt behavior for the authorization request. - 'select_account': Forces account selection (overrides accountName) modal to show. - 'consent': Forces the consent modal to show. Applies only to when offlineAccess is enabled. You may pass an array (['consent', 'select_account']) to show both modals. 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: { checkPlayServices: (showErrorResolutionDialog?: boolean) => Promise<PlayServicesInfo>; clearCachedAccessToken: (tokenString: string) => Promise<null>; configure: (options: OneTapConfigureParams) => void; createAccount: CreateAccountInterface; enableAppCheck: (params?: EnableAppCheckParams) => Promise<null>; presentExplicitSignIn: ExplicitSignInInterface; requestAuthorization: (options: RequestAuthorizationParams) => Promise<AuthorizationResponse>; revokeAccess: (emailOrUniqueId: string) => Promise<null>; signIn: SignInInterface; signOut: () => Promise<null>; } The entry point of the Universal 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\tType checkPlayServices()\t(showErrorResolutionDialog?: boolean) => Promise<PlayServicesInfo> clearCachedAccessToken()\t(tokenString: string) => Promise<null> configure()\t(options: OneTapConfigureParams) => void createAccount\t(params?: OneTapCreateAccountParams) => Promise<OneTapResponse> enableAppCheck()\t(params?: EnableAppCheckParams) => Promise<null> presentExplicitSignIn\t(params?: OneTapExplicitSignInParams) => Promise<OneTapExplicitSignInResponse> requestAuthorization()\t(options: RequestAuthorizationParams) => Promise<AuthorizationResponse> revokeAccess()\t(emailOrUniqueId: string) => Promise<null> signIn\t(params?: OneTapSignInParams) => Promise<OneTapResponse> signOut()\t() => 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[]; } Properties Property\tType\tDescription scopes\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; } Properties Property\tType accessToken\tstring idToken\tstring ","version":null,"tagName":"h3"},{"title":"HasPlayServicesParams","type":1,"pageTitle":"API reference","url":"/docs/api#hasplayservicesparams","content":" HasPlayServicesParams = { showPlayServicesUpdateDialog?: boolean; } Properties Property\tType\tDescription showPlayServicesUpdateDialog?\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; } Properties Property\tType\tDescription loginHint?\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. Only available in the paid version. For support across all platforms, use the Universal 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. Properties Property\tType\tDescription data\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; }; } Properties Property\tType\tDescription idToken\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: { addScopes: (options: AddScopesParams) => Promise<SignInResponse | null>; clearCachedAccessToken: (tokenString: string) => Promise<null>; configure: (options?: ConfigureParams) => void; enableAppCheck: (params?: EnableAppCheckParams) => Promise<null>; getCurrentUser: () => User | null; getTokens: () => Promise<GetTokensResponse>; hasPlayServices: (options?: HasPlayServicesParams) => Promise<boolean>; hasPreviousSignIn: () => boolean; revokeAccess: () => Promise<null>; signIn: (options: SignInParams) => Promise<SignInResponse>; signInSilently: () => Promise<SignInSilentlyResponse>; signOut: () => Promise<null>; } The entry point of the Google Sign In API, exposed as GoogleSignin. Type Declaration Name\tType addScopes()\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: "IN_PROGRESS"; NULL_PRESENTER: "NULL_PRESENTER"; PLAY_SERVICES_NOT_AVAILABLE: "PLAY_SERVICES_NOT_AVAILABLE"; }> Read more about the meaning of the error codes in the guide. ","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: unknown): 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\tunknown 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":"GoogleLogoButtonProps","type":1,"pageTitle":"API reference","url":"/docs/api#googlelogobuttonprops","content":" GoogleLogoButtonProps = { label?: string; shape?: "rectangular" | "circular"; textStyle?: StyleProp<TextStyle>; theme?: "light" | "dark" | "neutral"; variant?: "standard" | "icon"; } Properties Property\tType\tDescription label?\tstring\t- shape?\t"rectangular" | "circular"\t- textStyle?\tStyleProp<TextStyle>\tStyle for the button text. Provide the Roboto font family with a weight of 500. theme?\t"light" | "dark" | "neutral"\t- variant?\t"standard" | "icon"\t- ","version":null,"tagName":"h3"},{"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":"GoogleLogoButton","type":1,"pageTitle":"API reference","url":"/docs/api#googlelogobutton","content":" const GoogleLogoButton: React.FC<PressableProps & GoogleLogoButtonProps> Sign in button that follows the Google branding guidelines. ","version":null,"tagName":"h3"},{"title":"WebGoogleSigninButton","type":1,"pageTitle":"API reference","url":"/docs/api#webgooglesigninbutton","content":" const WebGoogleSigninButton: React.FC<WebGoogleSignInButtonProps> ","version":null,"tagName":"h3"},{"title":"GoogleSigninButton()","type":1,"pageTitle":"API reference","url":"/docs/api#googlesigninbutton","content":" GoogleSigninButton(props: GoogleSigninButtonProps): Element Native Google Sign-In button component. Prefer using the GoogleLogoButton for a more customizable button. Parameters Parameter\tTypeprops\tGoogleSigninButtonProps 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":"AuthorizationPrompt","type":1,"pageTitle":"API reference","url":"/docs/api#authorizationprompt","content":" AuthorizationPrompt = "consent" | "select_account" ","version":null,"tagName":"h3"},{"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. Properties Property\tType data\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. Union Members Type Literal { iosClientId?: string; } Name\tType\tDescriptioniosClientId?\tstring\tIf you want to specify the client ID of type iOS. It is taken from the GoogleService-Info.plist file by default. Type Literal { googleServicePlistPath?: string; } Name\tType\tDescriptiongoogleServicePlistPath?\tstring\tiOS only. Use this to specify a different bundle path name for the GoogleService-Info Firebase config file. Example "GoogleService-Info-Staging" ","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. Properties Property\tType data\tnull type\t"noSavedCredentialFound" ","version":null,"tagName":"h3"},{"title":"Web Universal sign in module","type":1,"pageTitle":"API reference","url":"/docs/api#web-universal-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 Universal 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. Properties Property\tType\tDescription momentListener?\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":"GoogleLogoButton","type":0,"sectionRef":"#","url":"/docs/buttons/google-logo-button","content":"","keywords":"","version":null},{"title":"Features","type":1,"pageTitle":"GoogleLogoButton","url":"/docs/buttons/google-logo-button#features","content":" Available in standard and icon-only variantsCustomizable shape (rectangular or circular)Supports light, dark, and neutral themesFull customization possible via Pressable props ","version":null,"tagName":"h2"},{"title":"Usage","type":1,"pageTitle":"GoogleLogoButton","url":"/docs/buttons/google-logo-button#usage","content":" See API reference for props. import { GoogleLogoButton } from '@react-native-google-signin/google-signin'; function SignInScreen() { return ( <GoogleLogoButton onPress={() => { // Handle sign in }} label="Sign in with Google" textStyle={{ fontFamily: 'Roboto' }} /> ); } ","version":null,"tagName":"h2"},{"title":"Font Requirements","type":1,"pageTitle":"GoogleLogoButton","url":"/docs/buttons/google-logo-button#font-requirements","content":" The button should render its label using the Roboto font with weight of 500 to match Google's branding guidelines. Make sure to: Include the Roboto font in your app (see example for Expo).Provide the font family in the textStyle prop: <GoogleLogoButton textStyle={{ fontFamily: 'Roboto' }} /> ","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":"WebGoogleSigninButton","type":0,"sectionRef":"#","url":"/docs/buttons/web","content":"","keywords":"","version":null},{"title":"Usage","type":1,"pageTitle":"WebGoogleSigninButton","url":"/docs/buttons/web#usage","content":" As the Universal 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 opens 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":"Configuration Doctor","type":0,"sectionRef":"#","url":"/docs/config-doctor","content":"","keywords":"","version":null},{"title":"Why","type":1,"pageTitle":"Configuration Doctor","url":"/docs/config-doctor#why","content":" To save time. Developers sometimes waste hours or even days tracking down the errors. This tool gives you the SHA-1 fingerprints that need to be added to your Google project configuration to resolve the error. ","version":null,"tagName":"h2"},{"title":"Usage","type":1,"pageTitle":"Configuration Doctor","url":"/docs/config-doctor#usage","content":" The tool can extract SHA-1 fingerprints directly from a device/emulator with your app installed, or from an APK file. Run the command as shown below and follow the instructions. # Usage with device/emulator npx @react-native-google-signin/config-doctor --package-name com.yourapp.name # Usage with an APK file npx @react-native-google-signin/config-doctor --apk-path ./app-release.apk ","version":null,"tagName":"h2"},{"title":"Arguments","type":1,"pageTitle":"Configuration Doctor","url":"/docs/config-doctor#arguments","content":" --package-name (optional): Your Android app's package name. If provided, the tool extracts the APK from a connected device/emulator.--apk-path (optional): Path to an APK file. ","version":null,"tagName":"h3"},{"title":"When to use","type":1,"pageTitle":"Configuration Doctor","url":"/docs/config-doctor#when-to-use","content":" When getting DEVELOPER_ERROR, unexpected cancelled or even GetCredentialProviderConfigurationException during Sign-In. You can run into these errors: When setting up Google Sign-In for the first timeAfter downloading your app from Play StoreWhen switching between debug and release builds ","version":null,"tagName":"h2"},{"title":"Example Output","type":1,"pageTitle":"Configuration Doctor","url":"/docs/config-doctor#example-output","content":" ✔ Application package name: com.some.app.android 🔍 Found the following SHA-1 certificate fingerprints: A1:B2:C3:D4:E5:F6:G7:H8:I9:J0:K1:L2:M3:N4:O5:P6:Q7:R8:S9:T0 Next steps: ... ","version":null,"tagName":"h3"},{"title":"Requirements","type":1,"pageTitle":"Configuration Doctor","url":"/docs/config-doctor#requirements","content":" Active license (get access at universal-sign-in.com)Android device/emulator with your app installed, OR a built APK file ","version":null,"tagName":"h2"},{"title":"Related Documentation","type":1,"pageTitle":"Configuration Doctor","url":"/docs/config-doctor#related-documentation","content":" Collecting configuration information ","version":null,"tagName":"h2"},{"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. These constants are stable canonical values exported by the library, so you can compare error.code to statusCodes.* with good TypeScript support. Less common native failures may still surface other string values. 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 are 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. NULL_PRESENTER\tHappens in the unlikely situation when the Activity (on Android) or UIViewController (on iOS) for presenting the sign in UI isn't available. See example usage. ","version":null,"tagName":"h3"},{"title":"Installation","type":0,"sectionRef":"#","url":"/docs/install","content":"","keywords":"","version":null},{"title":"Universal Sign In (premium)","type":1,"pageTitle":"Installation","url":"/docs/install#premium","content":" ⭐️ Key Features: Cross-Platform: Unified APIs which work on Android, iOS, Web, and macOS. Android: Built with Credential Manager libraryWeb: Uses Sign In with Google for WebiOS & macOS: Powered by the Google Sign-In SDK Licensed: see pricing and license. Trusted: 1 mil+ npm downloads. Faster: Reduce sign-up and sign-in times on Android, according to Google. See the UI: screenshots of the features. Widely compatible & stable: Both old and new architecture of React Native are supported. See version compatibility table below. 🔧 Easier setup: Android Config Doctor to diagnose configuration errors before they cost you hours.Automatic detection of configuration parameters for faster integration. 🛡️ Advanced security features 📱 An example app — to showcase all features on native and web ","version":null,"tagName":"h3"},{"title":"Public version (free)","type":1,"pageTitle":"Installation","url":"/docs/install#public-version-free","content":" Available on the public npm registry, this version: Built on the deprecated legacy Android Google Sign-In SDK — Google has since moved away from it, and may remove it from Play Services at their discretion. The free package will continue to use a version where this SDK is present.Has platform support limited to Android and iOS.Contains none of the extra features listed above. To migrate from the public version to the premium one, follow the migration guide. ","version":null,"tagName":"h3"},{"title":"Accessing the private npm package","type":1,"pageTitle":"Installation","url":"/docs/install#package-manager-setup","content":" The private npm package is like any other, but it's hosted on the GitHub npm packages registry, not the public npm registry. Therefore, a small bit of setup is needed: Set up access via the subscription dashboard. Obtain here a Personal Access Token with packages:read permission and set expiration to "No expiration". Set up your package manager to fetch the package from the GitHub packages registry. In this example, we're using an NPM_TOKEN_GOOGLE_SIGN_IN environment variable. yarn v3+npm / yarn v1pnpmbunCI environments (GH Actions...) create a .yarnrc.yml file in your project root with the following content: .yarnrc.yml npmScopes: react-native-google-signin: npmRegistryServer: https://npm.pkg.github.com npmAuthToken: '${NPM_TOKEN_GOOGLE_SIGN_IN}' ","version":null,"tagName":"h2"},{"title":"Installing","type":1,"pageTitle":"Installation","url":"/docs/install#installing","content":" yarnnpmpnpmbun yarn add @react-native-google-signin/google-signin@latest After installing: if you're using the Universal version, open the lockfile (yarn.lock / 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 the package manager is not configured correctly — try uninstalling and reinstalling the package. 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":"Requirements","type":1,"pageTitle":"Installation","url":"/docs/install#requirements","content":" For latest version of Universal Sign In, compileSdkVersion must be >= 35 and kotlinVersion must be >= 2.0.21 in your Android project. If you use Expo SDK 53 or newer, these requirements are already met. Use expo-build-properties to specify these values on Expo SDK <= 52. The latest version of the Universal Sign In package supports (use older versions of the package if you run older React Native / Expo): \tsupported rangeexpo\t52.0.40 - 56 react-native\t0.76.0 - 0.86 We recommend Expo and EAS for building and deploying your React Native app. Expo offers the best developer experience and is well-supported by this library. ","version":null,"tagName":"h2"},{"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 calling requestAuthorization or by adding the necessary scopes when calling configure. 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":"Migration guides","type":0,"sectionRef":"#","url":"/docs/migrating","content":"","keywords":"","version":null},{"title":"Migrating from Original to Universal Sign In","type":1,"pageTitle":"Migration guides","url":"/docs/migrating#migrating-from-original-to-universal-sign-in","content":" Migrating from Original to Universal module is mostly about changing the method names: the table summarizes the mapping from Original module's calls to the Universal (OneTap) module's calls: Original Method\tUniversal (OneTap) Method\tNotesconfigure\tconfigure\tSame functionality. signInSilently\tsignIn\tUniversal's signIn attempts sign in without user interaction. signIn\tcreateAccount\tUniversal's createAccount is for first-time sign in (but can be used for existing users too). addScopes\trequestAuthorization\tSimilar functionality, different parameters. On Android, you can call requestAuthorization without being signed in! hasPlayServices\tcheckPlayServices\tSame functionality, different name. getCurrentUser\tUse signIn response\tManage the current user state yourself, or through libraries like Firebase Auth or Supabase Auth. getTokens\tUse signIn or requestAuthorization\tTokens are included in the response object. signOut\tsignOut revokeAccess\trevokeAccess\tUniversal requires email/id parameter on web. hasPreviousSignIn\tUse signIn response\tCheck for noSavedCredentialFound response type. clearCachedAccessToken\tclearCachedAccessToken\tSame functionality. ","version":null,"tagName":"h2"},{"title":"Migrating to the new JS API","type":1,"pageTitle":"Migration guides","url":"/docs/migrating#migrating-to-the-new-js-api","content":" Version 13 introduced a new JS API, which changes some method response signatures and makes minor changes to error handling (details here). If you're upgrading from version 12 or earlier, you'll need to make some minor adjustments. ","version":null,"tagName":"h2"},{"title":"Universal Sign In","type":1,"pageTitle":"Migration guides","url":"/docs/migrating#universal-sign-in","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":"h3"},{"title":"Original Sign In","type":1,"pageTitle":"Migration guides","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":"h3"},{"title":"Universal sign in","type":0,"sectionRef":"#","url":"/docs/one-tap","content":"","keywords":"","version":null},{"title":"Usage","type":1,"pageTitle":"Universal sign in","url":"/docs/one-tap#usage","content":" You can copy-paste this snippet to get a complete sign-in flow quickly. Read more about the methods below. example of going through the sign in flow import { GoogleOneTapSignIn, GoogleLogoButton, } from '@react-native-google-signin/google-signin'; <GoogleLogoButton onPress={startSignInFlow} label="Sign in with Google" />; export const startSignInFlow = async () => { try { GoogleOneTapSignIn.configure(); // move this to after your app starts await GoogleOneTapSignIn.checkPlayServices(); const signInResponse = await GoogleOneTapSignIn.signIn(); if (signInResponse.type === 'success') { // use signInResponse.data } else if (signInResponse.type === 'noSavedCredentialFound') { // the user wasn't previously signed into this app const createResponse = await GoogleOneTapSignIn.createAccount(); if (createResponse.type === 'success') { // use createResponse.data } else if (createResponse.type === 'noSavedCredentialFound') { // no Google user account was present on the device yet (unlikely but possible) const explicitResponse = await GoogleOneTapSignIn.presentExplicitSignIn(); if (explicitResponse.type === 'success') { // use explicitResponse.data } } } // the else branches correspond to the user canceling the sign in } catch (error) { // handle error } }; Note that on Apple and Android, you can combine the Universal sign in methods with those one from the Original Google Sign In. To do that, use the Universal sign in to sign in the user. Then call signInSilently() and then (for example) getCurrentUser() to get the current user's information. However, this shouldn't be necessary because this module should cover all your needs. Please open an issue if that's not the case. ","version":null,"tagName":"h2"},{"title":"Methods","type":1,"pageTitle":"Universal sign in","url":"/docs/one-tap#methods","content":" ","version":null,"tagName":"h2"},{"title":"configure","type":1,"pageTitle":"Universal 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 also 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":"signIn","type":1,"pageTitle":"Universal 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. If there is no user that was previously signed in, the returned 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.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":"Universal 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":"Universal 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. UI screenshots Android\tiOS\tWeb await GoogleOneTapSignIn.createAccount(); ","version":null,"tagName":"h3"},{"title":"presentExplicitSignIn","type":1,"pageTitle":"Universal sign in","url":"/docs/one-tap#presentexplicitsignin","content":" signature: (params?: OneTapExplicitSignInParams) => Promise<OneTapExplicitSignInResponse> Platform\tBehaviorAndroid\tPresents the sign in dialog explicitly. This is useful 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 prompts 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 button. UI screenshots Android\tiOS\tWeb await GoogleOneTapSignIn.presentExplicitSignIn(); ","version":null,"tagName":"h3"},{"title":"checkPlayServices","type":1,"pageTitle":"Universal sign in","url":"/docs/one-tap#checkplayservices","content":" 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). 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). On Android, the 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. 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.Web: resolves when the Google Client Library is loaded, rejects otherwise. Example of checkPlayServices() method await GoogleOneTapSignIn.checkPlayServices(); ","version":null,"tagName":"h3"},{"title":"signOut","type":1,"pageTitle":"Universal sign in","url":"/docs/one-tap#signout","content":" signature: () => Promise<null> Signs out the current user. This disables the automatic sign-in. Returns a Promise that resolves with null or rejects in case of error. await GoogleOneTapSignIn.signOut(); ","version":null,"tagName":"h3"},{"title":"revokeAccess","type":1,"pageTitle":"Universal sign in","url":"/docs/one-tap#revokeaccess","content":" signature: (emailOrUniqueId: string) => Promise<null> Revokes access given to the current application and signs the user out. Use when a user deletes their account in your app. On the web, you need to provide the id or email of the user. On Android and Apple, the emailOrUniqueId parameter does not have any effect. Returns a Promise that resolves with null or rejects in case of error. await GoogleOneTapSignIn.revokeAccess(user.id); ","version":null,"tagName":"h3"},{"title":"requestAuthorization","type":1,"pageTitle":"Universal sign in","url":"/docs/one-tap#requestauthorization","content":" 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. UI screenshots Android\tiOS\t ","version":null,"tagName":"h3"},{"title":"clearCachedAccessToken","type":1,"pageTitle":"Universal sign in","url":"/docs/one-tap#clearcachedaccesstoken","content":" signature: (accessTokenString: string) => Promise<null> This method is only needed on Android. You may run into a 401 Unauthorized error when an access token is invalid. Call this method to remove the token from local cache and then call requestAuthorization() to get a fresh access token. Calling this method on Apple does nothing and always resolves. This is because on Apple, requestAuthorization() always returns valid tokens, refreshing them first if they have expired or are about to expire (see docs). ","version":null,"tagName":"h3"},{"title":"Automatic webClientId & iosClientId detection","type":1,"pageTitle":"Universal sign in","url":"/docs/one-tap#automatic-config","content":" 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":"Universal sign in","url":"/docs/one-tap#web-support","content":" Learn more. ","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":"Universal sign in screenshots","type":0,"sectionRef":"#","url":"/docs/screenshots","content":"","keywords":"","version":null},{"title":"signIn","type":1,"pageTitle":"Universal sign in screenshots","url":"/docs/screenshots#signin","content":" 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: ","version":null,"tagName":"h3"},{"title":"createAccount","type":1,"pageTitle":"Universal sign in screenshots","url":"/docs/screenshots#createaccount","content":" UI screenshots Android\tiOS\tWeb ","version":null,"tagName":"h3"},{"title":"requestAuthorization","type":1,"pageTitle":"Universal sign in screenshots","url":"/docs/screenshots#requestauthorization","content":" UI screenshots Android\tiOS\t ","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 authentication APIs in Universal Sign-In for Apple, Android and web allow you to specify nonce. On native platforms, if it's not specified, a cryptographically random value is generated internally. 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: expo-cryptoreact-native-quick-crypto 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` (SHA-256 hash, hex-encoded) 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: [ /* what APIs you want to access on behalf of the user, default is email and profile this is just an example, most likely you don't need this option at all! */ 'https://www.googleapis.com/auth/drive.readonly', ], offlineAccess: false, // 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 prompts 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":"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 { // ... 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":"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":" note This package cannot be used in Expo Go because it uses native code. This applies to both the Original and Universal modules. However, you can add custom native code to an Expo app by using a development build. That is the recommended approach for production apps, and is documented in this guide. ","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 these instructions. 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, follow these instructions to get google-services.json file for Android and these instructions) to get GoogleService-Info.plist for iOS. Place them into your project and 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":"Build the native app","type":1,"pageTitle":"Expo setup","url":"/docs/setting-up/expo#build-the-native-app","content":" Run the following to generate the native project directories. npx expo prebuild --clean Rebuild your app and read the config guide! npx expo run:android && npx expo run:ios ","version":null,"tagName":"h2"},{"title":"Collecting configuration information","type":0,"sectionRef":"#","url":"/docs/setting-up/get-config-file","content":"","keywords":"","version":null},{"title":"Android","type":1,"pageTitle":"Collecting configuration information","url":"/docs/setting-up/get-config-file#android","content":" Follow the two steps below to set up Google Sign In for your Android app. warning In case you encounter any of the following issues, revisit this guide - it means the steps below weren't fully completed. if you ever get the infamous DEVELOPER_ERROR errorif you can sign in with debug APK and not in release (or vice versa) ","version":null,"tagName":"h2"},{"title":"Step 1: Collect SHA-1 (not SHA-256) certificate fingerprints","type":1,"pageTitle":"Collecting configuration information","url":"/docs/setting-up/get-config-file#step-1-collect-sha-1-not-sha-256-certificate-fingerprints","content":" Your Android app probably uses multiple signing configurations. For example, an app might be signed differently when building debug and release APKs locally or when building on Expo EAS. Then there's the Play App Signing for store deployments — Google Play Store may re-sign your app using one of its own signing configurations. important If your app is not yet in the Play Store, focus only on the development APK and its SHA-1 certificate fingerprint. You can come back to this guide later when you upload your app to the Play Store. However, be advised that in the end, you need to get the SHA-1 certificate fingerprints for all signing configurations and then use all of those SHA-1 fingerprints in Step 2 below. Collect SHA-1 certificate fingerprints from: ✅ Any APK or deviceGoogle Play Store (when downloading from it)EAS BuildLocal build Use the Configuration Doctor. This is the only universal option — it works regardless of how the APK was built or where it came from. The other tabs cover specific scenarios. Get a device / emulator with the app installed, or get the APK (build it locally or in cloud, download from the Play Console / Play Store...)Run the tool and follow its instructions: npx @react-native-google-signin/config-doctor ","version":null,"tagName":"h3"},{"title":"Step 2: Add SHA-1 fingerprints to Firebase or Google Cloud Console","type":1,"pageTitle":"Collecting configuration information","url":"/docs/setting-up/get-config-file#step-2","content":" For each of the SHA-1 fingerprints obtained in the previous step, follow the instructions below. When using FirebaseWhen not using Firebase Sign in to Firebase Console and open your project.Ensure that in the "Authentication" menu, "Google" is enabled as "Sign-in method".Click the settings icon and go to "Project settings".Scroll down to "Your apps" section, and select the app.Click "Add fingerprint".Check that "Package name" is correct.Download the google-services.json file. ","version":null,"tagName":"h3"},{"title":"iOS","type":1,"pageTitle":"Collecting 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.Ensure that in the "Authentication" menu, "Google" is enabled as "Sign-in method".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","type":1,"pageTitle":"Collecting configuration information","url":"/docs/setting-up/get-config-file#web-client-id","content":" To get a Web Client ID (for the configure() call), go to Google Cloud Console and find an existing one (it may have been already created by Firebase) or create a new OAuth Client ID of type Web. ","version":null,"tagName":"h2"},{"title":"Summary","type":1,"pageTitle":"Collecting configuration information","url":"/docs/setting-up/get-config-file#summary","content":" At the end of this guide, regardless of whether you use Firebase, when you visit Google Cloud Console, you should have in the "OAuth 2.0 Client IDs" section: Android OAuth Client ID(s) with SHA-1 fingerprintsiOS OAuth Client ID(s) with iOS URL schemeWeb Client ID ","version":null,"tagName":"h2"},{"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":"Sign in result is cancelled even though the user did not cancel the flow","type":1,"pageTitle":"FAQ / Troubleshooting","url":"/docs/troubleshooting#unexpected_cancelled","content":" You may be hitting an error in the Android SDK. This error is usually observed with presentExplicitSignIn. Follow the DEVELOPER_ERROR paragraph to resolve it. ","version":null,"tagName":"h3"},{"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 DEVELOPER_ERROR 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 (! absolutely always !) a configuration mismatch between your app and the server-side setup (in Firebase or Google Cloud console). Firstly, if you are using Firebase Auth, verify Google is enabled as a Sign-in method in Firebase Console (Build -> Authentication -> Sign-in method). Then: if you have the APK (on your phone, or computer) that gives this error, we recommend to run the Configuration Doctor and follow its instructions: npx @react-native-google-signin/config-doctor Otherwise: Follow the setup guide and perform its steps once again.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".Search the issue tracker for old reports of the error. ","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 DEVELOPER_ERROR 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":"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":"Sign in result is cancelled even though the user did not cancel the flow","type":1,"pageTitle":"FAQ / Troubleshooting","url":"/docs/troubleshooting#sign-in-result-is-cancelled-even-though-the-user-did-not-cancel-the-flow","content":" Make sure you're not presenting the sign-in flow while a modal (e.g. with a loading indicator) is already presented. ","version":null,"tagName":"h3"},{"title":"The app crashes when tapping the Sign In button","type":1,"pageTitle":"FAQ / Troubleshooting","url":"/docs/troubleshooting#the-app-crashes-when-tapping-the-sign-in-button","content":" Along with "Your app is missing support for the following URL schemes" error in Xcode console. Your Url Schemes configuration is incorrect. If you use Expo, verify 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 the 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 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. Because only one openURL method can be defined, if you have multiple listeners for openURL, you must combine them into a single function as shown below: For AppDelegate written in Swift If your AppDelegate a Swift file (the default in React Native 0.77.0 or higher), you'll need to: Add the following import to your project's bridging header file (usually ios/YourProject-Bridging-Header.h): // … // ⬇️ Add this import #import <GoogleSignIn/GoogleSignIn.h> Modify your AppDelegate.swift file: // … @main class AppDelegate: RCTAppDelegate { // … // ⬇️ Add this method override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool { // Add any other URL handlers you're using (e.g. Facebook SDK) return ApplicationDelegate.shared.application(app, open: url, options: options) || GIDSignIn.sharedInstance.handle(url) } } For AppDelegate written in Objective-C For AppDelegate written in Objective-C (the default prior to React Native 0.77), modify your AppDelegate.m file: #import "AppDelegate.h" #import <GoogleSignIn/GoogleSignIn.h> // ⬅️ add the header import // … @implementation AppDelegate // … // ⬇️ Add this method before file @end - (BOOL)application:(UIApplication *)application openURL:(nonnull NSURL *)url options:(nonnull NSDictionary<NSString *,id> *)options { // Add any other URL handlers you're using (e.g. Facebook SDK) return [[FBSDKApplicationDelegate sharedInstance] application:application openURL:url options:options] || [GIDSignIn.sharedInstance handleURL:url]; } @end ","version":null,"tagName":"h3"},{"title":"Web setup guide","type":0,"sectionRef":"#","url":"/docs/setting-up/web","content":"","keywords":"","version":null},{"title":"Usage","type":1,"pageTitle":"Web setup guide","url":"/docs/setting-up/web#usage","content":" See here. ","version":null,"tagName":"h2"},{"title":"Testing","type":0,"sectionRef":"#","url":"/docs/testing","content":"","keywords":"","version":null},{"title":"Setting up the mock","type":1,"pageTitle":"Testing","url":"/docs/testing#setting-up-the-mock","content":" If you want to write JS-level tests that depend on Google Sign In, you need to mock the functionality of the native module - this is because the native code cannot run in Node.js environment. 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" ] } ","version":null,"tagName":"h2"},{"title":"Writing tests","type":1,"pageTitle":"Testing","url":"/docs/testing#writing-tests","content":" You can use @testing-library/react-native to write tests for React components that use React Native Google Sign In. Minimal example (make sure to set up the mock first): App.test.js import { GoogleOneTapSignIn, OneTapResponse, } from '@react-native-google-signin/google-signin'; import * as React from 'react'; import { render, screen, fireEvent } from '@testing-library/react-native'; import { Button, Text } from 'react-native'; import { useState } from 'react'; function GoogleSignInComponent() { const [userInfo, setUserInfo] = useState<OneTapResponse | undefined>(); return ( <> <Button title="Sign in with Google" onPress={async () => { GoogleOneTapSignIn.configure({ webClientId: 'autoDetect', }); const userInfo = await GoogleOneTapSignIn.signIn(); setUserInfo(userInfo); }} /> {userInfo && <Text>{userInfo.data?.user.name}</Text>} </> ); } it('GoogleSignInComponent should display user name after signing in', async () => { // Render the component render(<GoogleSignInComponent />); const expectedUserName = 'mockFullName'; // Verify user name is not displayed initially expect(screen.queryByText(expectedUserName)).toBeNull(); // Find and press the sign-in button const signInButton = screen.getByText('Sign in with Google'); fireEvent.press(signInButton); // verify the user name is displayed const userName = await screen.findByText(expectedUserName); expect(userName).toBeTruthy(); }); ","version":null,"tagName":"h2"},{"title":"Web support","type":0,"sectionRef":"#","url":"/docs/web-support","content":"","keywords":"","version":null},{"title":"Setup","type":1,"pageTitle":"Web support","url":"/docs/web-support#setup","content":" See here. ","version":null,"tagName":"h2"},{"title":"Usage","type":1,"pageTitle":"Web support","url":"/docs/web-support#usage","content":" To implement web support, follow these two 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. ","version":null,"tagName":"h2"},{"title":"Methods","type":1,"pageTitle":"Web support","url":"/docs/web-support#methods","content":" The methods on the web are the same as on native — see here for their docs. ","version":null,"tagName":"h2"}],"options":{"disableVersioning":true,"excludeRoutes":["/docs/license"],"id":"default"}}