native-google-login
installation
1. iOS
$ yarn add native-google-login$ cd ios$ pod install
create GoogleLoginUtil.swift
import GoogleSignIn @objcclass GoogleLoginUtil: NSObject { @objc static func initGoogleSDK() -> Void { GIDSignIn.sharedInstance()?.clientID = "YOUR_CLIENT_ID" } @objc static func handleOpenUrl(url: URL) -> Bool { guard let googleSharedInstance = GIDSignIn.sharedInstance() else { return false } if (googleSharedInstance.handle(url)) { return googleSharedInstance.handle(url) } return false }}
AppDelegate.m
...- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions ... - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
go to xcode -> info -> URL Types
add com.googleusercontent.apps.{YOUR_GOOGLE_CLIENT_ID}
in url scheme
2. android
open strings.xml
<!-- add this line -->YOUR_GOOGLE_CLIENT_ID
open build.gradle(app)
<!-- add this line -->implementation 'com.google.android.gms:play-services-auth:18.1.0'
how to use
; const google = async { const configure = GoogleLogin // in android, you need to provide webClientId to get idToken const signInResult = await GoogleLogin const signOutResult = await GoogleLogin const disconnectResult = await GoogleLogin}