react-native-twitter icon indicating copy to clipboard operation
react-native-twitter copied to clipboard

auth(tokens, callbackUrl[, options]) not redirecting back to application

Open KeanuTomatoMomotaro opened this issue 7 years ago • 1 comments

After the application has opened the browser to authenticate the user, it does not redirect back to the application.

I've unlocked the "lock callback url" settings in the twitter developer apps settings, and supplied these parameters to my manifest:

<application
      android:name=".MainApplication"
      android:allowBackup="true"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:theme="@style/AppTheme">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data
                android:scheme="appName"
                android:host="main"
            />
        </intent-filter>
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
    </application>

Then the method i used to sign in would be:

signInTwitter(){
      var tokens= {
        consumerKey:         'xxx',
        consumerSecret:      'xxx,         
      };

      callbackUrl = 'appName://main'
      
      auth(tokens, callbackUrl)
      .then((credentials) => {
        console.log(credentials)
      }).catch(console.error);
    }

KeanuTomatoMomotaro avatar Nov 21 '17 06:11 KeanuTomatoMomotaro

You have to put something like https://appName in the twitter app where you got your keys from. Also what I've found lately is twitter doesn't really work well with Camel case so I'd suggest renaming your app to appname, or something else all lowerCase.

ahmedu007 avatar Apr 12 '18 09:04 ahmedu007