Android上的oauth_callback

Bos*_*one 6 twitter android oauth

我创建了一个Twitter应用程序,我需要Android应用程序的用户授权使用它.我正处于可以在浏览器中调用Twitter应用程序页面并成功授权的位置.但是,回调似乎不起作用,我最终在浏览器中显示确认消息和PIN但我的Android活动从未被调用(onResume未被触发).这就是我所拥有的

  1. Twitter网址:http://twitter.com/oauth/authorize ?oauth_token = actualtokenhere &oauth_callback = myapp///
  2. 在我的活动定义中,我有这个intent-filter

            <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="myapp" />
        </intent-filter>
    
    Run Code Online (Sandbox Code Playgroud)
  3. 正如我所说 - 我得到确认但没有重定向,因此Android应用程序永远不会被回调

Bos*_*one 7

好吧,事实证明我的配置没有任何问题.我的Twitter应用程序设置错误"应用程序类型"如果您遇到此问题 - 转到Twitter上的应用程序编辑视图并检查"应用程序类型"的"浏览器"选项,然后如果身份验证成功,浏览器会重定向到回调URL .现在 - 我无法使用Android风格的回调URL(myapp:// twitt),因为它不会通过表单验证.但事实证明 - 你可以在那里输入任何有效的URL,并在你的代码中提供实际的回调URL