1.2.0 • Published 7 years ago
asq-react-native-google-sign-in v1.2.0
React Native Google Sign In
Minimalistic implementation of Google's sign in SDK. Authenticates using public profile and email scopes. Sign in returns token data required to authenticate user serverside.
Installation
Minimum Requirements
| react-native | iOS |
|---|---|
| 0.50 | 10.3 |
NPM package
npm install asq-react-native-google-sign-inGetting started
Install GoogleSignIn via cocoapods: add
pod 'GoogleSignIn'to your Podfile and runpod installAdd
node-modules/asq-react-native-google-sign-in/ios/ASQGoogleSignIn.xcodeprojto your LibrariesAdd
libASQGoogleSignIn.aunder Link Binary With Libraries in Build PhasesAdd
$(SRCROOT)/../node_modules/asq-react-native-google-sign-in/ios/ASQGoogleSignInto your Header Search Paths in Build SettingsMake sure you have your
GoogleServices-Info.plistlocated in root of project directory (whereInfo.plistis located)Add following to AppDelegate.m file
// Import at the top of your file
#import "ASQGoogleSignIn.h"
// Add to handle google's deep links (place before @end)
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<NSString *, id> *)options {
BOOL googleLink = [ASQGoogleSignIn handleURL:url
sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
annotation:options[UIApplicationOpenURLOptionsAnnotationKey]];
return googleLink;
}Usage
import GoogleSignIn from "asq-react-native-google-sign-in";signIn
const user = await GoogleSignIn.signIn();signOut
GoogleSignIn.signOut();