rn-social-auth
v1.3.6
Published
Reusable Google and Apple sign-in helpers for React Native
Maintainers
Readme
rn-social-auth
Simple Google and Apple sign-in for React Native.
Installation
npm install rn-social-authAlso install peer dependencies:
npm install @react-native-google-signin/google-signin @invertase/react-native-apple-authenticationQuick Start
Google Sign-In
import { configureGoogleSignIn, signInWithGoogle, signOutGoogle } from 'rn-social-auth';
// Configure once
configureGoogleSignIn({
webClientId: 'YOUR_WEB_CLIENT_ID.apps.googleusercontent.com',
});
// Sign in
const result = await signInWithGoogle();
// Sign out
await signOutGoogle();Apple Sign-In
iOS
import {
configureAppleSignInIOS,
signInWithAppleIOS,
AppleRequestOperation,
AppleRequestScope,
} from 'rn-social-auth';
// Configure (optional)
configureAppleSignInIOS({
requestedOperation: AppleRequestOperation.LOGIN,
requestedScopes: [AppleRequestScope.FULL_NAME, AppleRequestScope.EMAIL],
});
// Sign in
const result = await signInWithAppleIOS();Android
import {
configureAppleSignInAndroid,
signInWithAppleAndroid,
AndroidScope,
AndroidResponseType,
} from 'rn-social-auth';
// Configure (required)
configureAppleSignInAndroid({
clientId: 'com.yourcompany.yourapp',
redirectUri: 'https://yourdomain.com/auth/callback',
scope: AndroidScope.ALL,
responseType: AndroidResponseType.ALL,
});
// Sign in
const result = await signInWithAppleAndroid();API
configureGoogleSignIn(config: ConfigureParams)- Configure Google Sign-InsignInWithGoogle()- Sign in with GooglesignOutGoogle()- Sign out from GoogleconfigureAppleSignInIOS(config: AppleRequestOptions)- Configure Apple Sign-In for iOSsignInWithAppleIOS(config?: AppleRequestOptions)- Sign in with Apple on iOSconfigureAppleSignInAndroid(config: AndroidConfig)- Configure Apple Sign-In for AndroidsignInWithAppleAndroid(config?: AndroidConfig)- Sign in with Apple on Android
Setup Requirements
Google Sign-In:
- Get
webClientIdfrom Google Cloud Console
Apple Sign-In:
- iOS: Enable "Sign in with Apple" capability in Xcode
- Android: Create Services ID in Apple Developer Portal
License
ISC
