oauth_callback在Androidoauth_callback、Android

由网友(梦想的初衷)分享简介:我创建了一个Twitter的应用程序,我需要我的Andr​​oid应用程序,授权其使用的用户。我在的地步,我可以调用Twitter的应用程序页面在浏览器和成功授权。然而,回调似乎没有工作,我结束了在浏览器中的确认信息和PIN但我Android的活动永远不会被调用(onResume不触发)。下面是我的在微博网址:htt...

我创建了一个Twitter的应用程序,我需要我的Andr​​oid应用程序,授权其使用的用户。我在的地步,我可以调用Twitter的应用程序页面在浏览器和成功授权。然而,回调似乎没有工作,我结束了在浏览器中的确认信息和PIN但我Android的活动永远不会被调用(onResume不触发)。 下面是我的

在微博网址:http://twitter.com/oauth/authorize?oauth_token=actualtokenhere&oauth_callback=myapp:///

在我的活动定义我有这个意图过滤器

 <意向滤光器>
<作用机器人:名称=android.intent.action.VIEW/>
<类机器人:名称=android.intent.category.DEFAULT/>
<类机器人:名称=android.intent.category.BROWSABLE/>
<数据机器人:计划=MyApp的/>
    &所述; /意图滤光器>
 

正如我所说 - 我得到确认,但不是重定向使Android应用程序是从来没有叫回来

解决方案

好了,竟然没有什么错我的配置。我的Twitter的应用程序根本就错误的设置为应用型 如果你有这样的问题 - 去在Twitter上你的应用程序编辑视图,并选中浏览器选项为应用程序类型,那么,如果认证成功的浏览器重定向到回调URL。现在 - 我不能使用Android的风格的回调URL(的myapp:// twitt),因为这不会通过表单验证。但实际上 - 你可以输入任何有效的URL出现在你的code提供了实际工作的回调URL

Oauth2认证

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

Twitter URL: http://twitter.com/oauth/authorize?oauth_token=actualtokenhere&oauth_callback=myapp:///

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>

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

解决方案

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

阅读全文

相关推荐

最新文章