Skip to content

bangslosan/ti.googlesignin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ti.GoogleSignIn

Build Status License Contact

Summary

Ti.GoogleSignIn is an open-source project to support the Google SignIn iOS-SDK in Appcelerator's Titanium Mobile.

Requirements

  • Titanium Mobile SDK 5.5.1.GA or later
  • iOS 7.1 or later
  • Xcode 7.3 or later

Download + Setup

Download

Setup

Unpack the module and place it inside the modules/iphone/ folder of your project. Edit the modules section of your tiapp.xml file to include this module:

<modules>
    <module platform="iphone">ti.googlesignin</module>
</modules>

Add the following URL types to your plist section of the tiapp.xml:

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLName</key>
        <string>google</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <!-- Example: com.googleusercontent.apps.123456789-xxxxxxxx -->
            <string>YOUR_REVERSE_CLIENT_ID</string>
        </array>
    </dict>
</array>

Initialize the module by setting the Google SignIn API key you can get from the Google API Console.

var Google = require('ti.googlesignin');
Google.initialize({
    clientId: '<client-id>',

    // Optional properties:
    serverClientId: '<server-client-id>',
    scopes: ['https://www.googleapis.com/auth/plus.login'], // See https://developers.google.com/identity/protocols/googlescopes for more
    language: 'de', // Or 'de-DE', 'en-US', etc.
    loginHint: 'Titanium rocks!',
    hostedDomain: 'https://my-hosted-domain.com',
    shouldFetchBasicProfile: false, // Default: true
    openIDRealm: 'my-openID-realm',
});

Methods

  • signIn
  • signInSilently
  • signOut
  • disconnect
  • hasAuthInKeychain
  • currentUserImageURLWithSize

Properties

  • currentUser

Events

  • login
  • disconnect
  • cancel
  • error
  • load
  • open
  • close

The login- and disconnect events include a user key that includes the following user-infos:

id, scopes, serverAuthCode, hostedDomain, profile, authentication

Build

If you want to build the module from the source, you need to check some things beforehand:

  • Set the TITANIUM_SDK_VERSION inside the ios/titanium.xcconfig file to the Ti.SDK version you want to build with.
  • Build the project with appc run -p ios --build-only
  • Check the releases tab for stable pre-packaged versions of the module

Features

TBA

Example

For a full example, check the demos in example/app.js and example/clustering.js.

Author

Hans Knoechel (@hansemannnn / Web)

License

Apache 2.0

Contributing

Code contributions are greatly appreciated, please submit a new pull request!

About

Use the native Google Sign In SDK in Appcelerator Titanium.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 94.5%
  • JavaScript 5.5%