Flutter Twitter Login Plugin
twitter_login_v2: ^0.0.3
/example/android/app/src/main/AndroidManifest.xm
You need to replace {example} with a Callback URLs.
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Accepts URIs that begin with "example://gizmos” -->
<!-- Registered Callback URLs in TwitterApp -->
<data android:scheme="{example}"
android:host="gizmos" /> <!-- host is option -->
</intent-filter>
If you created your project with a version prior to 1.12, you will need to update your project to use the new Java Embedding API.
Make sure flutter_embedding v2 is enabled. Add the following code on the manifest file inside tag to enable embedding.
Flutter wiki: Upgrading pre 1.12 Android projects.
<meta-data
android:name="flutterEmbedding"
android:value="2" />
/example/ios/Runner/Info.plist
You need to replace {example} with a Callback URLs.
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string></string>
<key>CFBundleURLSchemes</key>
<array>
<!-- Registered Callback URLs in TwitterApp -->
<string>{example}</string>
</array>
</dict>
</array>
final twitterLogin = TwitterLoginV2(
clientId: "CLIENT_ID", /// Consumer API keys
redirectURI: "REDIRECT_URI", /// Registered Callback URLs in TwitterApp
scopes: ["tweet.read", "tweet.write", "follows.read", "users.read","offline.access"]
);
final accessToken = await twitterLogin.loginV2();
The scopes that can be specified are available here: https://developer.twitter.com/en/docs/authentication/oauth-2-0/authorization-code