【问题标题】:Does the following OAuth process to authorise users still supported by twitter?twitter 是否仍然支持以下用于授权用户的 OAuth 流程?
【发布时间】:2012-01-12 01:40:48
【问题描述】:

我想制作一个可以在 twitter 上更新状态的 android 应用程序。 我正在使用 signpost-core-1.2.1.1 和 signpost-commonshttp4-1.2.1.1 jar 文件。我已授予互联网使用权限,并且我已在 Twitter 中注册应用程序,授予读取、写入和直接消息权限。还填了回调Url。但是retrieveRequestToken()函数抛出OAuthCommunicationException。

代码sn-p:

private  static  final  String CALLBACK_URI = "app://twitter";
private static final String REQUEST_TOKEN_URL = "https://api.twitter.com/oauth/request_token";
private static final String ACCESS_TOKEN_URL = "https://api.twitter.com/oauth/access_token";
private static final String AUTHORIZE_URL = "https://api.twitter.com/oauth/authorize";

String CONSUMER_KEY = "I4bwezijxf6VwpU8x0tygg";
String CONSUMER_SECRET = "Y6vSdZs3zWBrNogXZWSHKZ590RSXqB5wBwj8vFaayk";

private static  CommonsHttpOAuthConsumer consumer;
private static CommonsHttpOAuthProvider provider;

consumer = new CommonsHttpOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET);
provider = new DefaultOAuthProvider(REQUEST_TOKEN_URL,ACCESS_TOKEN_URL, AUTHORIZE_URL);
String authUrl="";

authUrl = provider.retrieveRequestToken(consumer,CALLBACK_URI);

我完全被这个困住了。请回复。

【问题讨论】:

    标签: android oauth twitter


    【解决方案1】:

    您的消费者凭据在我的测试 Twitter 应用程序中运行良好,因此找不到您的问题。
    这是关于 Twitter 集成的完整详细文章,您可以在您的应用中复制 TwitterConnectWebActivity 的代码,并通过意图来调用它以进行 Twitter 集成。
    Twitter integration in Android app complete code

    这必须解决您的问题问题。

    【讨论】:

    • 谢谢。但我运行了你的代码。我遇到了同样的通信异常。我不知道是什么问题。
    • 我想可能是我的android虚拟设备的问题
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-21
    • 2011-11-07
    • 1970-01-01
    • 2016-03-26
    • 1970-01-01
    相关资源
    最近更新 更多