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.
Minimum Requirements
react-native | iOS |
---|---|
0.50 | 10.3 |
NPM package
npm install asq-react-native-google-sign-in
-
Install GoogleSignIn via cocoapods: add
pod 'GoogleSignIn'
to your Podfile and runpod install
-
Add
node-modules/asq-react-native-google-sign-in/ios/ASQGoogleSignIn.xcodeproj
to your Libraries -
Add
libASQGoogleSignIn.a
under Link Binary With Libraries in Build Phases -
Add
$(SRCROOT)/../node_modules/asq-react-native-google-sign-in/ios/ASQGoogleSignIn
to your Header Search Paths in Build Settings -
Make sure you have your
GoogleServices-Info.plist
located in root of project directory (whereInfo.plist
is 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;
}
import GoogleSignIn from "asq-react-native-google-sign-in";
const user = await GoogleSignIn.signIn();
GoogleSignIn.signOut();