GithubHelp home page GithubHelp logo

web5design / twitter-titanium Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ebryn/twitter-titanium

0.0 3.0 0.0 2.07 MB

The easiest way to handle Twitter authentication in your Titanium Mobile app

twitter-titanium's Introduction

twitter-titanium

twitter-titanium is a client-side Twitter library for Titanium Mobile. It simplifies the task of authenticating a user via Twitter. A backend is not required. It's designed to emulate the API of the Facebook module included in Titanium Mobile.

It presents a very simple and straightforward API. You provide your OAuth configuration and simply call authorize(). The user is prompted with a modal WebView to login to Twitter. After the user has logged in, the WebView disappears and a login event is fired. Requests to Twitter's API endpoints are done with the request() function. We intentionally are not wrapping Twitter's API calls, this can become a maintainence issue if Twitter updates it's API.

How to use

There is an example app included in this repository. See app.js.

var client = Twitter({
  consumerKey: "INSERT YOUR KEY HERE",
  consumerSecret: "INSERT YOUR SECRET HERE"
});

client.authorize(); // Pops up a modal WebView

client.addEventListener('login', function(e) {
  if (e.success) {
    // Your app code goes here... you'll likely want to save the access tokens passed in the event.
    
    // Here's an example API call:
    client.request("1/statuses/home_timeline.json", {count: 100}, 'GET', function(e) {
      if (e.success) {
        var data = JSON.parse(e.result.text);
      } else {
        alert(e.error);
      }
    });
  } else {
    alert(e.error);
  }
});

To use twitter-titanium in your app, download and copy the following files into your app: twitter.js jsOAuth-1.3.1.js

Nice features

  • Android compatible and tested!
  • On iOS, a back button is displayed if the user does any navigation within the WebView. For example, if the user clicks the forgot password link.

Thanks

  • twitter-titanium uses the jsOAuth library by @bytespider
  • Metamorph.js by @wycats and @tomdale for inspiration

Contact

twitter-titanium was written by Erik Bryn. You can find him on Twitter at @ebryn.

twitter-titanium's People

Contributors

ebryn avatar matiaskorhonen avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.