Giter Club home page Giter Club logo

googlesigninkit's Introduction

GoogleSignInKit

SwiftPM Compatible

โš ๏ธ In its v1.0.0 this module is intended to be use in an iOS app only.

This module is intended to be used to do a "Google Sign-In" for your app. Using this module will give you ability to authenticate a user and either create him an account or log him to an existing account. What we call "sign-in" is composed in two parts :

  • First part is authenticating user and let him choose which Google account to use for sign-in. This is done on a Google dedicated web page.
  • Second part is retrieving credentials for the user-choosen account. This is done by doing a request on Google API. Let's see how it works (it's very easy ๐Ÿ˜‰).

Depending on how you want to use this module you have two possible flows.

First flow

Start by configuring the module by giving it a configuration (GoogleSignInKit.Manager.Configuration) through a call to the function configure(configuration:). This is only needed once in your app lifecycle. So you can do it from your AppDelegate or at init of you login view controller.

Then once sign-in is required call the function signIn(overrideConfig:completion:). Through this function you can override some parameters of the module configuration (but not the client ID) just for the time of the authentication by giving an optional GoogleSignInKit.Configuration struct. And of course give your completion block in which you'll receive the GoogleSignInKit.Credentials struct with all you need to do the account creation / sign-in. If you need do repeat the sign-in you can call this function again.

Second flow

When sign-in is required just call the function signIn(configuration:completion:). Through this single function you can set the module configuration and start sign-in. As a second paramter of course give your completion block in which you'll receive the GoogleSignInKit.Credentials struct with all you need to do the account creation / sign-in. If you need do repeat the sign-in you can either call this function again or call signIn(overrideConfig:completion:), it's up to you.

Need Demo ?

Here's a GoogleSignInKit-Demo project

googlesigninkit's People

Contributors

tibimac avatar

Stargazers

John D. Pope avatar

Watchers

James Cloos avatar  avatar

Forkers

johndpope

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.