Android 上的 oauth_callback [英] oauth_callback on Android

查看:14
本文介绍了Android 上的 oauth_callback的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个 Twitter 应用程序,我需要我的 Android 应用程序的用户来授权其使用.我现在可以在浏览器中调用 Twitter 应用程序页面并成功授权.但是,回调似乎不起作用,我最终在浏览器中收到确认消息和 PIN,但从未调用过我的 Android 活动(未触发 onResume).这是我所拥有的

I created a Twitter app I need user of my Android application to authorize its use. I'm at the point where I can call Twitter app page in the browser and successfully authorize. However, the callback seem not to be working, I end up with the confirmation message and PIN in the browser but my Android activity is never called (onResume is not triggered). Here's what I have

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

  1. Twitter URL: http://twitter.com/oauth/authorize?oauth_token=actualtokenhere&oauth_callback=myapp:///
  2. In my activity definition I have this 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>

  • 正如我所说 - 我得到确认但没有重定向,所以 Android 应用程序永远不会被回调

  • As I stated - I get confirmation but not redirect so the Android app is never called back

    推荐答案

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

    Well, turned out there was nothing wrong with my configuration. My twitter app simply had wrong setting for the "Application Type" If you have this problem - go to your app edit view on Twitter and check "browser" option for the "Application Type", then if authentication succeeds browser redirects to the callback URL. Now - I couldn't use Android-style callback URL (myapp://twitt) since that would not pass form validation. But turned out - you can enter anything that is valid URL there and provide the actuall callback URL in your code

    这篇关于Android 上的 oauth_callback的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆