Adapters
Integrate Google credentials with third-party auth and backend providers.
Adapters help connect Google ID tokens from this package to third-party authentication and backend providers.
Each provider supports two integration styles:
Plug-and-play integration
Pass the provider client and Google client IDs. The adapter performs the standard provider exchange internally.
const signInWithGoogle = createProviderGoogleAuth({
providerClient,
webClientId,
iosClientId,
});Use this approach when:
- You want the fastest path to a working integration.
- Your app connects directly to the provider SDK.
- You want the package to manage the standard token exchange.
- You do not need custom logic between Google sign-in and provider sign-in.
Custom integration
Pass the Google options and the provider operations separately.
const signInWithGoogle = createProviderGoogleAuthAdapter({
credentialOptions: {
webClientId,
iosClientId,
},
exchangeCredential: async ({ idToken, nonce }) => {
// Exchange the credential with your provider or backend.
},
});Use this approach when:
- Google credentials must pass through your backend.
- You need analytics, logging, or additional validation during sign-in.
- You want to link an identity instead of signing in.
- Your provider setup differs from the standard integration.