Latest 1.1.0
Homepage https://github.com/elsesiy/GAppAuth
License BSD-2-Clause
Platforms ios 8.0
Dependencies GTMAppAuth

This is a drop-in class to handle AppAuth with Google Services (currently supporting only iOS).

Installation via cocoapods

Just add this dependency to your Podfile:

pod GAppAuth

The transitive dependency to GTMAppAuth is added automatically.

Manually

Add GTMAppAuth dependency to your Podfile (Cocoapods) or copy the files manually to your project directory. Add GAppAuth.swift to your project and set-up you project as follows to use AppAuth with Google Services.

  1. Setup your project (iOS) at https://console.developers.google.com to retrieve ClientID and iOS scheme URL.
  2. Enable Google APIs as desired.
  3. Add ClientId and RedirectUri to your Info.plist:
    <key>GAppAuth</key>
    <dict>
    <key>RedirectUri</key>
    <string>com.googleusercontent.apps.YOUR-CLIENT-ID:/oauthredirect</string>
    <key>ClientId</key>
    <string>YOUR-CLIENT-ID.apps.googleusercontent.com</string>
    </dict>
  4. Add Custom URL-Scheme to your project:
    <key>CFBundleURLTypes</key>
    <array>
    <dict>
      <key>CFBundleURLSchemes</key>
        <array>
          <string>com.googleusercontent.apps.YOUR-CLIENT-ID</string>
        </array>
    </dict>
    </array>
  5. In order to authorize for any Google Service, you’d need to append the respective scope to the authorization request via:
    GAppAuth.shared.appendAuthorizationRealm (i.e. kGTLRAuthScopeDrive for Google Drive access).
  6. From any UIViewController start the authorization workflow by calling GAppAuth.shared.authorize.
  7. You might want to retrieve any existing authorization upon start of the app which can be done via GAppAuth.shared.retrieveExistingAuthorizationState.
A good spot for 5. and 7. is the AppDelegate’s didFinishLaunchingWithOptions.

Feel free to add any remarks or open up a PR.

Latest podspec

{
    "name": "GAppAuth",
    "version": "1.1.0",
    "summary": "Convenient Wrapper for AppAuth with Google Services written in Swift 3 (iOS).",
    "homepage": "https://github.com/elsesiy/GAppAuth",
    "license": "BSD-2-Clause",
    "authors": "Jonas-Taha El Sesiy",
    "social_media_url": "http://twitter.com/elsesiy",
    "source": {
        "git": "https://github.com/elsesiy/GAppAuth.git",
        "tag": "1.1.0"
    },
    "source_files": "Sources/GAppAuth.swift",
    "platforms": {
        "ios": "8.0"
    },
    "dependencies": {
        "GTMAppAuth": []
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This