Oauth Callback not found after permission on Twitter

Hey. I am developing an application using the twitter4j api. To enable the application and get the access token, I launch the browser with the callback parameters that I set in the manifest file.

<data android:scheme="scheme" android:host="authenticatorapp"></data> 

After resolving the application, the browser calls the following and does not work with the message not found. Schematic: // authenticatorapp oauth_token = n5vd99dfnmnf ...

I tried this on both the emulator and the device. In emulator, LogCat gives me the following:

12-12 15: 04: 05.743: ERROR / browser (230): scheme onReceivedError -10: // authenticatorapp? oauth_token = Jj ... M & oauth_verifier = 3ZfuY ... Protocol is not supported.

- manifest file:

  

    <activity android:name=".AuthenticatorApp"
        android:launchMode="singleInstance"
        >
        <intent-filter>         
            <category android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.LAUNCHER" />
            <data android:scheme="scheme" android:host="authenticatorapp"></data>                                
        </intent-filter>            
    </activity>

    <!-- Broadcast Receiver that will process AppWidget updates -->
    <receiver android:name=".ZaytungWidget" android:label="@string/widget_name">
        <intent-filter>
            <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />                             
        </intent-filter>
        <meta-data android:name="android.appwidget.provider"
            android:resource="@xml/tweet_metadata" />
    </receiver>
    <!-- Service to perform web API queries -->
    <service android:name=".ZaytungWidget$UpdateService" />
</application>

<uses-sdk android:minSdkVersion="4" />
    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
    <uses-permission android:name="android.permission.INTERNET" />    

+3
3

, .xml, org.gpsagenda.OAUTH - , .

        <activity android:name="org.gpsagenda.OAUTH" >
        <intent-filter>
            <action android:name="android.intent.action.VIEW"></action>
            <category android:name="android.intent.category.DEFAULT"></category>
            <category android:name="android.intent.category.BROWSABLE"></category>
            <data android:scheme="gpsagenda" android:host="twitt" />
        </intent-filter>
    </activity>
+1

If you are developing a native application, you do not use callback parameters, but you must allow the user to enter a PIN code in his application somewhere - what he gets when you open authorization_url in a browser or, perhaps, more comfortably in your application in the web watching.

You can also automatically retrieve a contact after a user clicks β€œyes” on the twitter authorization web page, but is not sure that he is against ToS twitter.

0
source

Source: https://habr.com/ru/post/1779841/


All Articles