Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

How to get a query string from a custom URL scheme from Safari?

I am implementing an oAuth based app, and part of the process is getting the Oauth Verifier from Safari comming from a Custom URL handle.

So Safari sends the following request to my app:


How can a get this query strings when my app starts?

— asked April 3rd 2010 by Antonio Silveira
  • custom
  • iphone
  • oauth
  • query
  • string

1 Answer

  • The oauth_callback end-point must be an Internet Url which is called by the remote service, it does not communicate with the client. To solve this use oauth_callback=oob (out-of-band): the service will provide the user with a pin that represents the oauth_verifier.

    With this library that I wrote, you can get it running in a few minutes, just 10 lines of code with the OAuth Adapter:

    var oAuthAdapter = new OAuthAdapter(
    // load the access token for the service (if previously saved)
    oAuthAdapter.send('https://api.twitter.com/1/statuses/update.json', [['status', 'hey @ziodave, I successfully tested the #oauth adapter with #twitter and @appcelerator #titanium!']], 'Twitter', 'Published.', 'Not published.');
    // if the client is not authorized, ask for authorization. the previous tweet will be sent automatically after authorization
    if (oAuthAdapter.isAuthorized() == false)
        // this function will be called as soon as the application is authorized
        var receivePin = function() {
            // get the access token with the provided pin/oauth_verifier
            // save the access token
        // show the authorization UI and call back the receive PIN function
        oAuthAdapter.showAuthorizeUI('http://twitter.com/oauth/authorize?oauth_token=' +
            oAuthAdapter.getRequestToken('http://twitter.com/oauth/request_token', [['oauth_callback', 'oob']]),
            receivePin, PinFinder.twitter);
    — answered July 2nd 2010 by David Riccitelli
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.