简体   繁体   中英

callback not getting called properly in twitter Integration

I am using following Code.

<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>

My Twitter app Callback Url is Callback URL http://m.devbee.com

Now the problem is after this function is called

@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;
    }

I click on "Authorize App" Button in my browser and instead of it calling my PrepareRequestTokenActivity activity, it gives error saying

Web Page Not avaliable.

Why the activity is not being called. The Urls are both same.

When you request temporary tokens for the OAuth Authentication Flow (request_tokens method), it does not return a Web page but some parameters written like GET (or POST) arguments in an HTTP request. See the corresponding documentation for more details : https://dev.twitter.com/docs/api/1/post/oauth/request_token . Moreover, do you follow Twitter instructions to authnticate your request correctly ( https://dev.twitter.com/docs/auth/authorizing-request ) ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM