在twitter集成中未正确调用回调



我正在使用以下代码。

<activity android:name=".PrepareRequestTokenActivity" android:launchMode="singleTask">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="http" android:host="m.devbee.com" />
    </intent-filter>
 </activity>

我的推特应用回调Url为Callback URL http://m.devbee.com

现在的问题是在这个函数被称为之后

@Override
    protected Void doInBackground(Void... params) {
        try {
            Log.i(TAG, "Retrieving request token from Google servers");
            final String url = provider.retrieveRequestToken(consumer, Constants.OAUTH_CALLBACK_URL);
            Log.i(TAG, "Popping a browser with the authorize URL : " + url);
            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)).setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_FROM_BACKGROUND);
            context.startActivity(intent);
        } catch (Exception e) {
            Log.e(TAG, "Error during OAUth retrieve request token", e);
        }
        return null;
    }

我点击浏览器中的"授权应用程序"按钮,它没有调用我的PrepareRequestTokenActivity活动,而是错误地说

Web Page Not avaliable.

为什么没有调用活动。Url都是一样的。

当您为OAuth身份验证流(request_tokens方法)请求临时令牌时,它不会返回网页,而是返回一些参数,如HTTP请求中的GET(或POST)参数。有关更多详细信息,请参阅相应的文档:https://dev.twitter.com/docs/api/1/post/oauth/request_token.此外,你是否按照Twitter的指示正确验证你的请求(https://dev.twitter.com/docs/auth/authorizing-request)?

最新更新