安卓叽叽喳喳retrieveRequestToken 401请求令牌 [英] android twitter retrieveRequestToken 401 on request token

查看:122
本文介绍了安卓叽叽喳喳retrieveRequestToken 401请求令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想对Twitter的OAuth的下面的示例应用程序。

I am trying the following sample app for twitter oauth.

http://www.androidsdkforum.com/android- SDK开发/ 3-支持OAuth twitter.html

private void askOAuth() {
        try {
            consumer = new CommonsHttpOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET);
            provider = new DefaultOAuthProvider("http://twitter.com/oauth/request_token",
                                                "http://twitter.com/oauth/access_token",
                                                "http://twitter.com/oauth/authorize");
            String authUrl = provider.retrieveRequestToken(consumer, CALLBACK_URL);
            Toast.makeText(this, "Please authorize this app!", Toast.LENGTH_LONG).show();
            this.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(authUrl)));
        } catch (Exception e) {
            Log.e(APP, e.getMessage());
            Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
        }
    }

当我运行下面的code它提供了异常如下

When i run the following code it gives exception as following

oauth.signpost.exception.OAuthNotAuthorizedException:。授权失败(与401服务器回答)这可能发生,如果消费者的关键是不正确或签名不匹配

"oauth.signpost.exception.OAuthNotAuthorizedException: Authorization failed (server replied with a 401). This can happen if the consumer key was not correct or the signatures did not match."

在这一行字符串authUrl = provider.retrieveRequestToken(消费者,CALLBACK_URL);

我提供了正确的钥匙和秘密呢微博给了我错了键和秘密?

I provided the correct 'key' and 'secret' does twitter giving me wrong key and secret ?

推荐答案

终于完成了,请查看下面的帖子

finally done, check out the following post

<一个href="http://stackoverflow.com/questions/3350895/android-twitter-outh-tutorial-callback-problem">http://stackoverflow.com/questions/3350895/android-twitter-outh-tutorial-callback-problem

这篇关于安卓叽叽喳喳retrieveRequestToken 401请求令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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