'flutter: twitter_login Exception: Exception: HttpException: Failed Forbidden

I have made the following changes into a Flutter developer account: redirect url: app_name://

Also I've made the following changes into Info.plist on iOS

<key>CFBundleURLTypes</key>
    <array>
      <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLName</key>
        <string></string>
        <key>CFBundleURLSchemes</key>
        <array>
          <string>app_name</string>
        </array>
      </dict>
    </array>

in AndroidManifest.xml I've made the following under :

<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="app_name" />
</intent-filter>

and in Flutter the following code generates the error

final twitterLogin = new TwitterLogin(
                                    apiKey: 'REAL_API_KEY',
                                    apiSecretKey: 'REAL_API_SECRET_KEY_Content',
                                    redirectURI: 'app_name://',
                                  );
                                  final authResult = await twitterLogin.login();
                                  final twitterAuthCredential = TwitterAuthProvider.credential(
                                    accessToken: authResult.authToken,
                                    secret: authResult.authTokenSecret,
                                  );
                                  UserCredential userCredential = await FirebaseAuth.instance.signInWithCredential(twitterAuthCredential);
                                  print(userCredential);

Exception: Exception: HttpException: Failed Forbidden is thrown in line

UserCredential userCredential = await FirebaseAuth.instance.signInWithCredential(twitterAuthCredential);


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source