Dave Allison
Dave Allison

Reputation: 375

Android intent-filter for http scheme

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 :

So can anybody help me with

Thanks for your help.

Upvotes: 5

Views: 3557

Answers (1)

Adrian Spinei
Adrian Spinei

Reputation: 550

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.

Upvotes: 3

Related Questions