React Native Google Credential

API Reference

Public types, defaults, result shape, and helper exports.

signInWithGoogleCredential(options)

Requests a Google credential from the current platform.

const credential = await signInWithGoogleCredential({
  webClientId,
  iosClientId,
  nonce,
  android: {
    flow: 'sign-in-button',
    accountFilter: 'authorized-first',
    autoSelect: true,
  },
  web: {
    autoSelect: true,
    useFedCm: true,
  },
});

Options

type GoogleCredentialOptions = {
  webClientId: string;
  iosClientId?: string | null;
  nonce?: string | null;
  android?: {
    flow?: 'credential' | 'sign-in-button';
    accountFilter?: 'all' | 'authorized-first';
    autoSelect?: boolean;
  };
  web?: {
    autoSelect?: boolean;
    useFedCm?: boolean;
    itpSupport?: boolean;
  };
};

Defaults

android.flow = 'sign-in-button';
android.accountFilter = 'authorized-first';
android.autoSelect = true;
web.autoSelect = true;
web.useFedCm = true;
web.itpSupport = true;

Result

type GoogleCredentialResult = {
  idToken: string;
  displayName: string | null;
  email: string | null;
  familyName: string | null;
  givenName: string | null;
  id: string | null;
  phoneNumber: string | null;
  profilePictureUri: string | null;
};

Only idToken is security-critical. Other fields are convenience metadata.

Helpers

import {
  clearGoogleCredentialState,
  isGoogleCredentialAvailable,
  signInWithGoogleCredential,
} from '@pricava/react-native-google-credential';

isGoogleCredentialAvailable() returns whether the current runtime can attempt Google credential sign-in.

clearGoogleCredentialState() clears or disables saved credential state when the platform supports it.

Platform-specific option behavior

OptionAndroidiOSWeb
webClientIdRequiredRequiredRequired
iosClientIdIgnoredRequired unless bundledIgnored
nonceSupportedSupportedSupported
android.flowSupportedIgnoredIgnored
android.accountFilterSupportedIgnoredIgnored
android.autoSelectSupportedIgnoredIgnored
web.autoSelectIgnoredIgnoredSupported
web.useFedCmIgnoredIgnoredSupported

Browser button APIs (1.1.0)

See Web for GoogleSignInButton, renderGoogleSignInButton, requestGoogleCredentialFromButton, browser adapter factories, and the optional per-call requestCredential strategy. All web options are ignored by native SDKs.

web.itpSupport controls One Tap ITP support and defaults to true. Structured browser error codes are documented in Troubleshooting.

On this page