Bob.Sims

Great new Titanium Alloy widget by Pablo Rodriguez.

Authenticate to Azure Mobile Services With Titanium Mobile

So after visiting the Microsoft Digital Crimes Unit earlier this week, I spent some time thinking about mobile security and authentication schemes. As a result, I decided to test how Titanium mobile could provide a cross-platform, native authentication experience against Azure backend mobile services.

One advantage of the Azure backend is that it accepts OAuth 2.0 authentication from Twitter, Facebook, Google, or Microsoft user accounts. Within a Titanium mobile app, Facebook has the advantage of a built-in module that eliminates the need for the developer to separately code a workflow for the exchange of network calls between the app, the identity provider, and the resource — also known as ”OAuth dance”. Facebook authentication provides for this interaction behind the scenes, already baked in to Titanium.

To share Titanium’s native Facebook module authentication for Azure backend access, you’ll need to wire together the following essential authentication steps:

  • retrieve authentication token from Facebook
  • present authentication token to Azure
  • after confirming the Facebook token’s validity, Azure returns an Azure authentication token
  • this token is then presented to Azure as the as the ‘X-ZUMO-AUTH’ header value for subsequent REST queries to the Azure backend database

Thanks to Titanium’s native Facebook module and HTTPClient API object, these steps are easy to implement.

For a simple test case, you can signup for your own Azure Free Trail. Here’s a tutorial that shows how to setup the backend app, you don’t have to do the “Create a New HTML App” section, as your iOS/Android Titanium app will provide the front end.

Next you’ll need to register your app through the Facebook Developers Portal (tutorial), then record the Facebook App ID and Consumer Secret within your Azure Management Portal's identity tab (tutorial).

Now on to the fun stuff — for this example, I created a new Titanium Alloy project.  You’ll want include the appropriate references to the Facebook module and Facebook App ID in your tiapp.xml as outlined in the Titanium API docs.

The authAzure method is where the magic happens. Once you’ve successfully retrieved the Azure authentication token, you can then use this token against the backend to perform REST queries.

To perform those REST queries, you will need to set the ‘X-ZUMO-AUTH’ HTTP header with the Azure auth token provided in the above example. Mads Møller’s excellent RestAPI sync adapter would probably be a great start for building out proper models and collections within the Alloy framework. His adapter allows custom HTTP headers to be set, which would allow a developer to set the X-ZUMO-AUTH auth token value.

In theory, you could use Aaron Saunder’s social_plus.js or Kosuke Isobe’s TiPlatformConnect in Titanium as starting points to add similar shared authentication schemes for Azure using Twitter or Google as identity providers.

At this point, learning to code is simply about understanding how the world functions.

word

NBA Superstar Chris Bosh: Here’s Why You Should Learn to Code | Wired Opinion | Wired.com (via davehyndman)

Wha…wait…uh…whaaat? This is a whole new level of awesome.

(via kevincurry)

Good read.

unbounded-io:

In a previous post, I discussed setting up Sublime Text, IntelliJ IDEA and MakeTi for a Titanium development workflow to be used as an alternative to Titanium Studio. With the release of Titanium 3.0, MakeTi is no longer needed as you can now use the Titanium CLI for creating,…

ceogeek:

So we’ve been very heads down for the past couple of months on Ti.Next. I know, I know. The suspense is killing you. It’s killing us too. I’ve tried (unsuccessfully) a couple of times to get into a place where we could open our github repo to the public so everyone could help participate and…

Via RicardoAlcocer.com:

Skypanther writes:

Got data to graph in Titanium? On its own, Ti doesn’t provide a graphing component. There is an iOS-only module in the Marketplace. But if you also need to support Android or want other graph types, you’re out of luck.

Fortunately, we can use the WebView, a suitable HTML graphing library, and some app-level events to rig up live graphs in our Titanium apps. The example shown here isn’t super-pretty, but it demonstrates the basic concept.

[More]

A simple YouTube player widget, code borrowed from Justin Toth. I needed a way to show YouTube videos at full screen, but with ability to exit back to the app window in iOS. This widget fits the bill.