views:

35

answers:

1

I built an Android application that requires OAuth. All was working well using a custom scheme call back which is intercepted by Android. It seems that Yahoo have changed the goal posts and now the custom scheme is not accepted by Yahoo.

I am now looking at possible alternate approaches. My first attempt is to use a normal http scheme and modify my intent filter to intercept the new URL. I have the following in my AndroidManifest.xml :

  <intent-filter>
    <action android:name="android.intent.action.VIEW"></action> 
    <category android:name="android.intent.category.DEFAULT"></category> 
    <category android:name="android.intent.category.BROWSABLE"></category>
    <data android:host="www.test.com" android:scheme="http"></data> 
  </intent-filter>

Where www.test.com will be substituted with a domain that I own. It seems :

* This filter is triggered when I click on a link on a page.
* It is not triggered on the redirect by Yahoo, the browser opens the website at www.test.com
* It is not triggered when I enter the domain name directly in the browser.

So can anybody help me with

* When exactly this intent-filter will be triggered?
* Any changes to the intent-filter or permissions that will widen the filter to apply to redirect requests?
* Any other approaches I could use?

Thanks for your help.

+1  A: 

How about an alternative solution, placing on your www.test.com a script that extracts the oauth parameters and redirects to your custom scheme callback?

Such as for instance oauth.php (pardon my PHP ...)

<?
header('Location:myschema://mythost?oauth_verifier='.urlencode( $_GET['oauth_verifier']).
    '&oauth_token='.urlencode($_GET['oauth_token']));
die();
?>

I am succesfully using it for Google OAuth which has the same restriction on the callback URL.

aspinei
Thanks. That is the approach I also used in the end. It is clunky but it works. Just frustrating to add an additional hop in to the process.
Dave Allison