3
回答
新浪微博oauth认证出错
华为云实践训练营,热门技术免费实践!>>>   

新浪微博oauth认证时出现错误Communication with the service provider failed:null

求解答,谢谢

代码如下

public Boolean requestAccessToken(Activity activity, String callBackUrl) {
        Boolean flag = false;
        try {
            httpOauthConsumer = new CommonsHttpOAuthConsumer(APP_KEY,
                    APP_SECRET);
            httpOauthprovider = new CommonsHttpOAuthProvider(
                    "http://api.t.sina.com.cn/oauth/request_token",
                    "http://api.t.sina.com.cn/oauth/access_token",
                    "http://api.t.sina.com.cn/oauth/authorize");
            String authUrl = httpOauthprovider.retrieveRequestToken(
                    httpOauthConsumer, callBackUrl);
            activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri
                    .parse(authUrl)));
            flag = true;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return flag;
    }



举报
汶水农夫
发帖于3年前 3回/195阅
顶部