Welcome to PovioKitAuthGoogle.
An auth provider for social login with Google.
- In Xcode, click
File->Add Packages... - Insert
https://github.com/povio/PovioKitAuthGooglein 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.
Please read official documentation from Google for all the details around the setup and integration.
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 UIApplicationDelegatePovioKitAuthGoogle is available under the MIT license. See the LICENSE file for more info.