[url=https://bitbucket.org/miroslavmagda/google-auth-for-titanium]Google OAuth 2.0 for Titanium[/url] is a module for [url=http://www.appcelerator.com/platform]Appcelerator Titanium[/url] that i’ve created for use in my mobile apps. It allows to authenticate user with Google OAuth 2.0 and then work with Google Apis.
To understand how it works you must check [url=https://developers.google.com/accounts/docs/OAuth2InstalledApp]Google Accounts Authentication and Authorization docs[/url].
[b]Example usage:[/b]
Check the demo App to see it in action. It is pretty simple but you will need to get your CLIENT_ID and CLIENT_SECRET from [url=https://code.google.com/apis/console/]Google Api Console[/url].
[b]Titanium code:[/b]
[b]Titanium demo:[/b]
[img]http://dl.iteye.com/upload/attachment/0081/8617/8ba46b46-dbfe-3519-a853-96e86a0fb3d4.png[/img]
[b]Titanium module:[/b]
[url=http://dl.iteye.com/topics/download/af8f9bd8-0a49-34f6-8863-73cf650a8b13]Download google-auth-for-titanium[/url]
[url=https://bitbucket.org/miroslavmagda/google-auth-for-titanium]https://bitbucket.org/miroslavmagda/google-auth-for-titanium[/url]
To understand how it works you must check [url=https://developers.google.com/accounts/docs/OAuth2InstalledApp]Google Accounts Authentication and Authorization docs[/url].
[b]Example usage:[/b]
Check the demo App to see it in action. It is pretty simple but you will need to get your CLIENT_ID and CLIENT_SECRET from [url=https://code.google.com/apis/console/]Google Api Console[/url].
[b]Titanium code:[/b]
//initialize module
var GoogleAuth = require('modules/googleAuth');
var googleAuth = new GoogleAuth({
clientId : 'CLIENT_ID',
clientSecret : 'CLIENT_SECRET',
propertyName : 'googleToken',
scope : ['https://www.googleapis.com/auth/tasks', 'https://www.googleapis.com/auth/tasks.readonly']
});
//create some button
var sync = Ti.UI.createButton({
title : 'Sync'
});
//do some action...
sync.addEventListener('click', function() {
googleAuth.isAuthorized(function() {
Ti.API.info('Access Token: ' + googleAuth.getAccessToken());
//user is authorized so do something... just dont forget to add accessToken to your requests
}, function() {
//authorize first
googleAuth.authorize();
});
});
[b]Titanium demo:[/b]
[img]http://dl.iteye.com/upload/attachment/0081/8617/8ba46b46-dbfe-3519-a853-96e86a0fb3d4.png[/img]
[b]Titanium module:[/b]
[url=http://dl.iteye.com/topics/download/af8f9bd8-0a49-34f6-8863-73cf650a8b13]Download google-auth-for-titanium[/url]
[url=https://bitbucket.org/miroslavmagda/google-auth-for-titanium]https://bitbucket.org/miroslavmagda/google-auth-for-titanium[/url]