Skip to content

povio/PovioKitAuthGoogle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to PovioKitAuthGoogle.
An auth provider for social login with Google.

Installation

Swift Package Manager

  • In Xcode, click File -> Add Packages...
  • Insert https://github.com/povio/PovioKitAuthGoogle in the Search field.
  • Select a desired Dependency Rule. Usually "Up to Next Major Version" with "2.0.0".
  • Select "Add Package" button and check PovioKitAuthGoogle.
  • Select "Add Package" again and you are done.

Setup

Please read official documentation from Google for all the details around the setup and integration.

Usage

import PovioKitAuthCore
import PovioKitAuthGoogle

// initialization
let authenticator = GoogleAuthenticator()

// signIn user
let result = try await authenticator
  .signIn(from: <view-controller-instance>)

// signIn with Firebase (custom client ID + nonce)
let firebaseResult = try await authenticator.signIn(
  from: <view-controller-instance>,
  clientId: "<firebase-client-id>",
  nonce: .random(length: 32)
)

// active session with a non-expired access token
let isSignedIn = authenticator.isAuthenticated

// Google has a stored session that can be restored (e.g. show "Continue as …")
let canRestore = authenticator.hasSavedSession

// signOut user
authenticator.signOut() // all provider data regarding the user auth is cleared at this point

// handle url
authenticator.canOpenUrl(url, application: application, options: options)
// call this from `application:openURL:options:` in UIApplicationDelegate

License

PovioKitAuthGoogle is available under the MIT license. See the LICENSE file for more info.

About

No description, website, or topics provided.

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages