2

我试过这段代码: http ://code.google.com/p/weibo-android-sdk/source/browse/example/src/com/weibo/android/example/AuthorizeActivity.java?r=12 你可以得到整个应用程序来自http://code.google.com/p/android-weibo-sdk/downloads/list 授权工作,但后来我从代码中更改了 appkey 和 appsecret,使用微博给我的开发人员帐户,在我更改后具有以下代码:

private static final String CONSUMER_KEY = "1415745064";// Replace a developer's appkey, for example, "1646212960";

private static final String CONSUMER_SECRET = "8cf118d44c9881b9d1cbf2c4eb957c57";// Replace a developer's appkey, e.g. "94098772160b6f8ffc1315374d8861f9";

private String username = "";

private String password = "";

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    mToken = (TextView) this.findViewById(R.id.tvToken);
    mLogin = (Button) this.findViewById(R.id.btnLogin);
    mLogin.setText("oauth!");
    mLogin.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (v == mLogin) {
                Weibo weibo = Weibo.getInstance();
                Log.d("onclick", "onclick");
                weibo.setupConsumerConfig(CONSUMER_KEY, CONSUMER_SECRET);
                // Oauth2.0
                // Implicit authorization and authentication
                Log.d("onclick", "dupa setupconsumerconfig");
                weibo.setRedirectUrl("http://www.sina.com");
                // Here the callback page content should replace the corresponding application callback page with appkey
                // Application callback page landing Sina microblogging development platform developers
                // Into my application - Application Details - Application Information - Senior - authorization settings - application callback page set up
                // and view
                // Application callback page is not empty
                Log.d("onclick", "dupa set redirecturl");

                weibo.authorize(AuthorizeActivity.this, new AuthDialogListener());
                Log.d("onclick", "dupa autorize");



            }
        }
    });

}

其余的代码是相同的,但是我没有向我显示我可以在其中写入我的电子邮件和密码以登录的对话框,而是收到一个带有错误的对话框。一些用中文写的,无法理解 id,比它说的:(error:redirect_uri)mismatch)。

4

0 回答 0