✳ Lambatoken / Mobile DocsAUTH 0.7.0 · WALLET 0.2.0
Authentication / 10

Google and Apple sign-in

Optional native adapters; preserve the Central Auth nonce and proof requirements.

Configure providers

Apple native iOS uses expo-apple-authentication. Google requires a nonce-capable Universal adapter (premium library) or an equivalent custom adapter. Do not use the original Google Sign-In library without nonce support. Provider IDs are public; provider client secrets stay on the backend.

typescript
import * as AppleAuthentication from 'expo-apple-authentication';
import { GoogleOneTapSignIn } from '@react-native-google-signin/google-signin';
import { createNativeProviders, createExpoAppleAdapter, createGoogleUniversalAdapter } from '@lambabros/mobile-auth-sdk';
GoogleOneTapSignIn.configure({ webClientId, iosClientId });
const providers = createNativeProviders(auth, {
  google: createGoogleUniversalAdapter(GoogleOneTapSignIn, webClientId),
  apple: createExpoAppleAdapter(AppleAuthentication, iosBundleId),
});

Login and registration

Call login for an existing identity, register for a new one. Registration is separate from login; complete required email verification. Login may return MFA-required. Cancellation is an ordinary UX outcome; never replay a consumed provider proof.

typescript
const result = await providers.google.login();
// Alternative: await providers.apple.login();
// Registration: await providers.google.register(username);
// Registration: await providers.apple.register(username);

Link or unlink identity

Authenticated users can link using primary credentials. Inspect sign-in methods first, and respect the last usable method rule. Apple proof differs between login and reauthentication.

typescript
await auth.identities.signInMethods();
await providers.apple.link(currentPassword);
const identities = await auth.identities.list();
// Explicit unlink: await auth.identities.unlink(identityId, currentPassword);

Provider-based reauthentication and password setup

Apple adapter exposes primary proof and password setup. Default Google adapter rejects primary reauthentication because fresh signed auth_time cannot be guaranteed. Apple Android browser callback is not implemented. Actual native provider builds remain unverified.

typescript
const proof = await providers.apple.reauthenticate("pin_set");
await auth.pin.set(newPin, proof);
// For social-only Apple account: await providers.apple.setPassword(newPassword);