0.1.3 • Published 4 years ago

native-google-login v0.1.3

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

native-google-login

installation

1. iOS

$ yarn add native-google-login
$ cd ios
$ pod install

create GoogleLoginUtil.swift

import GoogleSignIn

@objc
class 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

#import "{APPNAME}-Swift.h"
...
- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
#ifdef FB_SONARKIT_ENABLED
  InitializeFlipper(application);
#endif

  ....

  [GoogleLoginUtil initGoogleSDK];
  return YES;
}
...

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
  return [GoogleLoginUtil handleOpenUrlWithUrl:url];
}

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 -->
<string name="server_client_id">YOUR_GOOGLE_CLIENT_ID</string>

open build.gradle(app)

<!-- add this line -->
implementation 'com.google.android.gms:play-services-auth:18.1.0'

how to use

import GoogleLogin from "native-google-login";

const google = async () => {
    const configure = GoogleLogin.configure({ webClientId: "WEB_OAUTH_CLIENT_ID" }) // in android, you need to provide webClientId to get idToken
    const signInResult = await GoogleLogin.googleSignIn()
    const signOutResult = await GoogleLogin.googleSignOut()
    const disconnectResult = await GoogleLogin.googleDisconnect()
}
acornacorn-jsxabort-controllerajvJSONStreamacceptsadd-streamacorn-walkacorn-globalsaggregate-erroransi-alignabsolute-pathababanseransi-colorsansi-fragmentsansi-grayansi-stylesansi-regexansi-escapesansi-redansi-cyananymatchansi-wrapargparsearr-flattenarr-diffarray-find-indexarray-includesarray-ifyarr-unionarray-slicearray.prototype.flatmaparrifyarray-uniquearray-filterasn1array-reduceasaparray-maparray-unionassert-plusassign-symbolsasync-retryastral-regexasyncatobbabel-eslintaws-sign2aws4asynckitat-least-nodebabel-plugin-dynamic-import-nodebabel-plugin-istanbulbabel-jestbabel-polyfillbalanced-matchbabel-preset-current-node-syntaxbabel-plugin-jest-hoistbasebase64-jsbabel-preset-jestbcrypt-pbkdfbabel-plugin-syntax-trailing-function-commasbefore-after-hookbig-integerbabel-preset-fbjsbindingsbplist-creatorbrace-expansionbabel-runtimebracesboxenbrowserslistbserbytescache-basebuffer-crc32buffer-fromcaller-callsitecaller-pathbrowser-process-hrtimecamelcasecallsitescacheable-lookupbplist-parserchalkcacheable-requestcamelcase-keysbuiltinscapture-exitcaselesscaniuse-liteci-infochangelog-filename-regexchar-regexcli-boxeschardetclean-stackcli-spinnerscliuicli-cursorclass-utilscli-widthcollection-visitclone-responsecollect-v8-coveragecocolor-convertcolor-nameclonecolor-supportcommand-existscommandercombined-streamcolorettecommondircomponent-emitterconcat-mapcompare-funccompare-versionsconfigstorecompressibleconcat-streamcompressionconventional-changelog-atomconventional-changelog-conventionalcommitsconnectconventional-changelogconventional-changelog-angularconventional-changelog-eslintconventional-changelog-codemirrorconventional-changelog-coreconventional-changelog-emberconventional-changelog-expressconventional-changelog-preset-loaderconventional-changelog-jqueryconventional-changelog-jshintconventional-changelog-writercore-util-isconvert-source-mapcosmiconfigcross-spawnconventional-commits-parsercopy-descriptorconventional-commits-filtercrypto-random-stringcore-js-compatcssstyleconventional-recommended-bumpcsstypecurrently-unhandledcssomcreate-react-classdargscore-jsdecamelizedateformatdebugdashdashdata-urlsdecamelize-keysdeep-isdecimal.jsdecode-uri-componentdedentdefine-propertiesdeep-extenddecompress-responsedefaultsdefine-propertydeepmergedeldayjsdenodeifydelayed-streamdestroydetect-newlinedefer-to-connectdeprecationdepddoctrinedetect-repo-changelogdiff-sequencesdir-globdot-propdeprecated-objecc-jsbndomexceptionduplexer3emitteryemoji-regexelectron-to-chromiumejserror-exencodeurlencodingend-of-streamee-firstenquirererrorhandlerenvinfoescaladeescape-string-regexpeslint-plugin-eslint-commentseslint-plugin-flowtypeeslint-plugin-jesteslint-plugin-reacteslint-plugin-react-hookses-to-primitiveeslint-plugin-react-nativeeslint-plugin-react-native-globalsescape-goateslint-scopeeslint-utilseslint-visitor-keysesqueryestraverseesprimaesutilsespreeesrecurseescape-htmlescodegeneventemitter3es-abstractevent-target-shimeslint-plugin-relayexpand-bracketsexec-shexpectextendextend-shallowetagextglobexecafast-difffast-json-stable-stringifyfast-levenshteinfast-deep-equalexitextsprintfexternal-editorfast-globfile-entry-cachefancy-logfiguresfb-watchmanfile-uri-to-pathfastqfbjs-scriptsfbjsfind-upfilelistfbjs-css-varsfill-rangefind-cache-dirfinalhandlerflatflattedfor-inflat-cacheform-datafs.realpathforever-agentfind-versionsfunctional-red-black-treefreshfragment-cachefunction-bindfs-extrafseventsgensyncget-stdinget-streamget-valueget-pkg-repoget-caller-fileget-package-typegit-raw-commitsgetpassgit-remote-origin-urlgh-gotgitconfiglocalgit-semver-tagsgit-upgit-url-parseglobal-dirsglobglob-parentglobalsgraceful-fsgotglobbyhas-flaghar-schemahashas-symbolsgithub-usernamehas-valuegrowlyhar-validatorhas-yarnhas-valueshosted-git-infographqlhermes-profile-transformerhermes-enginehttp-cache-semanticshandlebarshtml-escaperhtml-encoding-snifferhttp2-wrapperhard-rejectionignoreimport-freshhttp-errorshttp-signaturehuman-signalsiconv-liteimage-sizeimurmurhashimport-localimport-cwdinflightiniimport-frominheritsinternal-slotimport-lazyinquirerindent-stringip-regexinvariantis-arrayishis-callableipis-accessor-descriptoris-date-objectis-ciis-bufferis-directoryis-extglobis-data-descriptoris-descriptoris-dockeris-globis-generator-fninterpretis-fullwidth-code-pointis-extendableis-git-dirtyis-negative-zerois-installed-globallyis-finiteis-plain-objis-numberis-npmis-git-repositoryis-path-insideis-objis-regexis-plain-objectis-potential-custom-element-nameis-symbolis-streamis-sshis-path-cwdis-stringis-text-pathis-windowsisarrayis-typedarrayisexeis-wslis-interactiveis-regular-fileistanbul-lib-reportistanbul-lib-coverageisobjectistanbul-lib-instrumentis-utf8istanbul-lib-source-mapsisstreamiterallistanbul-reportsisomorphic-fetchis-yarn-globaljest-changed-filesjest-clijest-configjest-eachjest-docblockjest-environment-nodejest-diffjest-get-typejest-environment-jsdomjest-jasmine2jest-haste-mapjest-leak-detectorjest-message-utiljest-regex-utiljest-matcher-utilsjest-mockjest-pnp-resolverjakejest-runtimejest-runnerjest-resolvejest-resolve-dependenciesjest-snapshotjest-validatejs-tokensjs-yamljest-workerjest-watcherjetifierjsescjson-parse-better-errorsjsbnjsc-androidjson-parse-even-better-errorsjsdomjson-schema-traversejson-stable-stringify-without-jsonifyjest-serializerjest-utiljson-bufferjson-schemajson-stable-stringifyjson5jsonparsekeyvjsonifyjsonfilejsprimjsx-ast-utilskind-oflevnlines-and-columnsload-json-filelocate-pathlodashlodash._reinterpolatelevenlatest-versionjson-stringify-safeklawlodash.templatesettingslevenarylog-symbolslodash.ismatchlodash.templatelodash.sortbylodash.findloud-rejectionlodash.throttlekleurmap-objlogkittyloose-envifymap-cachemake-dirmap-visitlru-cachelowercase-keysmacos-releasemakeerrormerge-streammetro-babel-registermeowmerge2metro-babel-transformermetro-configmetro-cachemetro-coremetrometro-react-native-babel-presetmetro-react-native-babel-transformermetro-minify-uglifymetro-source-mapmetro-inspector-proxymetro-resolvermetro-symbolicatemime-dbmime-typesminimatchminimist-optionsmimic-responsemimic-fnmin-indentmixin-deepmimemkdirpmsmute-streammodify-valuesnanomatchminimistmicromatchnannatural-comparenice-trynode-int64node-modules-regexpnode-fetchnode-notifiernormalize-package-datanegotiatornode-stream-zipnode-releasesnormalize-pathnpm-run-pathnwsapineo-asyncnullthrowsobject-assignobject-inspectnumber-is-nanoauth-signob1object-keysobject.assignobject.entriesobject.valuesobject.fromentriesobject-copyonceobject-visitobject.picknormalize-urlon-headersoptionatoronetimeoptionson-finishedoraos-namep-limitp-locateopencollective-postinstallopenp-tryp-cancelablep-finallyparent-modulep-each-seriesos-tmpdirp-mapparse-jsonparse-github-repo-urlpackage-jsonparse-urlpath-is-absolutepath-existspascalcaseparse-node-versionpath-keyparse5path-typeparseurlpath-parseparse-pathpinkie-promisepicomatchplease-upgrade-nodepiratespkg-dirposix-character-classesplugin-errorplistpinkieprettier-linter-helpersprepend-fileprocess-nextick-argsprepend-httpprelude-lspretty-formatprogressprop-typespromiseperformance-nowpseudomappifyprotocolsqquick-lrupunycodepromptspumpreact-isrange-parserpupaqsread-pkgread-pkg-upreadable-streamredentrcpslreact-refreshregenerateregexp.prototype.flagsregenerator-transformregex-notregexppreact-devtools-coreregexpu-coreregenerator-runtimeregenerate-unicode-propertiesrechoirregistry-auth-tokenremove-trailing-separatorregjsparserregjsgenrepeat-stringrepeatingrepeat-elementregistry-urlrequestrequest-promise-coreresolverequire-main-filenamerequire-directoryresolve-fromresolve-pkgresponselikeresolve-globalresolve-alpnresolve-urlresolve-cwdretretryrestore-cursorrimrafrsvprequest-promise-nativesafe-bufferreusifyrun-asyncsafe-regexrx-literx-lite-aggregatessemversemver-comparerun-parallelsaxsafer-buffersemver-regexsaxessemver-diffsendschedulerrxjssaneserve-staticset-blockingshebang-commandserialize-errorset-valuesetimmediatesetprototypeofside-channelsignal-exitshell-quoteshebang-regexshellwordssnapdragonsisteransislashsnapdragon-utilsnapdragon-nodeshelljsslidesource-map-resolvespdx-correctspdx-expression-parsespdx-exceptionssource-map-supportspdx-license-idssource-map-urlsimple-plistsplit-stringsplit2splitslice-ansisprintf-jsstacktrace-parserstatic-extendsource-mapsshpkstring.prototype.matchallstack-utilsstatusesstrip-ansistring.prototype.trimstartstrip-bomstring.prototype.trimendstrip-indentstring-lengthstrip-json-commentsstring_decoderstrip-final-newlinesupports-colorsudo-promptstrip-eofstring-widthstream-buffersstealthy-requiresymbol-observabletempsupports-hyperlinkstext-tabletest-excludeterminal-linkterm-sizetext-extensionsthrough2tablesymbol-treeto-fast-propertiesthroattime-stamptmpltmpto-object-pathto-readable-streamtrim-newlinesto-regextrim-off-newlinestslibthroughtoidentifiertsutilstunnel-agenttough-cookietypedarraytype-festtype-detectto-regex-rangetr46tweetnacltypedarray-to-buffertype-checkultronuglify-esunicode-canonical-property-names-ecmascriptunicode-match-property-ecmascriptunicode-match-property-value-ecmascriptuglify-jsunicode-property-aliases-ecmascriptunique-stringuri-jsunion-valueunset-valueuniversalifyurixua-parser-jsurl-joinutil-deprecateupdate-notifierunpipev8-compile-cacheurl-parse-laxvalidate-npm-package-licenseuseuniversal-user-agentuse-subscriptionv8-to-istanbuluuidvaryutils-mergevlqw3c-hr-timevalidate-npm-package-namewalkerw3c-xmlserializerverrorwhichwcwidthwhatwg-fetchwhich-modulewhich-pm-runswebidl-conversionswidest-linewhatwg-mimetypewrappywhatwg-encodingword-wrapwhatwg-urlwritewordwrapwrite-file-atomicwindows-releasewindow-sizewrap-ansiwsxdg-basedirxml-name-validatorxmldocxmlbuilderxpipextendxmlcharsxcodeyargsyargs-parsery18nxmldomyallistyaml
0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago