2

我正在使用 oAuth 来执行一些身份验证。

我尝试为此使用给定的 API,但我完全不明白发生了什么。

在使用 Android 2.2 的 Android 设备上。我在 webview 中输入用户名和密码,接收令牌,然后执行登录。

相同的代码,Android 4.0 上的相同调用返回“null”,我无法登录服务。

我记录了我需要的所有详细信息,并且应该获取令牌的方法返回 null。不知道在哪里记录,记录什么,检查什么。

11-08 14:16:19.576: W/Globals.Hyves.CONSUMER_KEY(946): 
11-08 14:16:19.576: W/Globals.Hyves.CONSUMER_SECRET(946): 
11-08 14:16:19.576: W/Globals.Hyves.REQTOKEN_LINK(946): http://data.hyves-api.nl/?strict_oauth_spec_response=true&methods=users.get,friends.get,wwws.create&ha_method=auth.requesttoken&ha_version=2.1
11-08 14:16:19.576: W/Globals.Hyves.REQACCESSTOKEN_LINK(946): http://data.hyves-api.nl/?strict_oauth_spec_response=true&ha_method=auth.accesstoken&ha_version=2.1
11-08 14:16:19.576: W/Globals.Hyves.AUTHORIZATION_LINK(946): http://www.hyves.nl/api/authorize/
11-08 14:16:19.681: W/Consumer(946): oauth.signpost.commonshttp.CommonsHttpOAuthConsumer@416263a0
11-08 14:16:19.710: W/Provider(946): oauth.signpost.commonshttp.CommonsHttpOAuthProvider@41624ad0
11-08 14:16:19.710: W/Globals.Hyves.REDIRECT_URI(946): connect://success
11-08 14:16:20.186: W/System.err(946): oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed: null
11-08 14:16:20.206: W/System.err(946):  at oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:214)

有谁知道某些默认页面编码之间是否存在差异,或者是否存在显着差异并且可能导致这在一个 android 上有效而在另一个 android 上无效。

这是我调用的行:

String authUrl = SignpostHandler.retrieveRequestTokenWithSignpost(provider, consumer, Globals.Hyves.REDIRECT_URI);

正如您在日志中看到的那样,我确实有提供者和消费者

4

1 回答 1

0

我认为您在没有 AsyncTask 的情况下执行 http get/post 请求。

我认为,这是 StrictMode 问题。这里有关 StrictMode 的信息

在 AsyncTask 中试试这个。这里有关 AsyncTask 的信息

于 2012-11-08T15:31:52.107 回答