GithubHelp home page GithubHelp logo

roughike / flutter_twitter_login Goto Github PK

View Code? Open in Web Editor NEW
84.0 84.0 137.0 125 KB

A Flutter plugin for authenticating users by using the native TwitterKit SDKs on Android & iOS.

License: BSD 2-Clause "Simplified" License

Java 23.66% Ruby 9.14% Objective-C 12.94% Dart 54.25%

flutter_twitter_login's People

Contributors

roughike avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

flutter_twitter_login's Issues

Please upgrade compileSdkVersion to 28

compileSdkVersion 27

Causes the compilation to fail with:
`> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade

Android resource linking failed
/Users/x/.gradle/caches/transforms-2/files-2.1/3aaf6e5219b7f981ec263df919098c6f/core-1.1.0/res/values/values.xml:142:5-173:25: AAPT: error: resource android:attr/fontVariationSettings not found.`

Updating to 28 solves this issue.

TwitterKit errors not propagating through authorize()

The error is not caught/propagated through authorize() on systems where the twitter app is not installed.

When calling authorize() with:

  1. result = await twitterInstance.authorize().catchError((e) => print("${e.toString()}"));
    or
  2. try{
    result = await twitterInstance.authorize();
    }catch(e){
    print("${e.toString()}");
    }

log result e.x.:
12:04:16.156 172 info flutter.tools [TwitterKit] did encounter error with message "Unable to authenticate using the system account.": Error Domain=TWTRLogInErrorDomain Code=0 "User denied access to system accounts." UserInfo={NSLocalizedDescription=User denied access to system accounts., NSLocalizedRecoverySuggestion=Give this user access to the System Twitter account.}

tried adding trivial catch to:
final Map<dynamic, dynamic> result =
await channel.invokeMethod('authorize', _keys).catchError(throw(' ...'));

Seems to work?

Example not working

Hi,

Thanks for writing this plugin.

I cloned the example and ran it on Android (Pixel) with the Twitter app installed. I get the same behavior I'm getting in my actual app:

  • the Twitter authorization view appears
  • I tap Connect
  • It says "Authenticating" then displays exactly the same Twitter authorization view
  • I tap Connect again, it says "Authenticating" again, then it takes me back to the app. However, the future returned by authorize never completes
  • If I tap Log in again, it errors with the below output in the debug console
Launching lib\main.dart on Pixel in debug mode...
Built build\app\outputs\apk\debug\app-debug.apk.
D/NetworkSecurityConfig(17043): No Network Security Config specified, using platform default
W/ActivityThread(17043): handleWindowVisibility: no activity for token android.os.BinderProxy@d9a52dd
W/Twitter (17043): Authorize already in progress
W/Twitter (17043): Authorize already in progress
E/Twitter (17043): Authorization completed with an error
E/Twitter (17043): com.twitter.sdk.android.core.TwitterAuthException: Authorize failed.
E/Twitter (17043): 	at com.twitter.sdk.android.core.identity.TwitterAuthClient.handleAuthorize(TwitterAuthClient.java:112)
E/Twitter (17043): 	at com.twitter.sdk.android.core.identity.TwitterAuthClient.authorize(TwitterAuthClient.java:103)
E/Twitter (17043): 	at com.roughike.fluttertwitterlogin.fluttertwitterlogin.TwitterLoginPlugin.authorize(TwitterLoginPlugin.java:88)
E/Twitter (17043): 	at com.roughike.fluttertwitterlogin.fluttertwitterlogin.TwitterLoginPlugin.onMethodCall(TwitterLoginPlugin.java:54)
E/Twitter (17043): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:200)
E/Twitter (17043): 	at io.flutter.view.FlutterNativeView.handlePlatformMessage(FlutterNativeView.java:163)
E/Twitter (17043): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/Twitter (17043): 	at android.os.MessageQueue.next(MessageQueue.java:326)
E/Twitter (17043): 	at android.os.Looper.loop(Looper.java:160)
E/Twitter (17043): 	at android.app.ActivityThread.main(ActivityThread.java:6669)
E/Twitter (17043): 	at java.lang.reflect.Method.invoke(Native Method)
E/Twitter (17043): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/Twitter (17043): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
W/terloginexampl(17043): Accessing hidden field Lsun/misc/Unsafe;->theUnsafe:Lsun/misc/Unsafe; (light greylist, reflection)
W/terloginexampl(17043): Accessing hidden method Lcom/android/org/conscrypt/OpenSSLSocketImpl;->setAlpnProtocols([B)V (light greylist, reflection)
W/terloginexampl(17043): Accessing hidden method Lcom/android/org/conscrypt/OpenSSLSocketImpl;->getAlpnSelectedProtocol()[B (light greylist, reflection)

Output of flutter doctor -v:

[√] Flutter (Channel beta, v0.11.3, on Microsoft Windows [Version 10.0.17134.407], locale en-AU)
    • Flutter version 0.11.3 at C:\Users\Kent\Repository\flutter
    • Framework revision 72bf075e8d (8 days ago), 2018-11-09 20:36:17 -0800
    • Engine revision 5646e86a6f
    • Dart version 2.1.0 (build 2.1.0-dev.9.3 9c07fb64c4)

[√] Android toolchain - develop for Android devices (Android SDK 28.0.3)
    • Android SDK at C:\Users\Kent\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
    • All Android licenses accepted.

[√] Android Studio (version 3.2)
    • Android Studio at C:\Program Files\Android\Android Studio
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

[!] VS Code (version 1.29.1)
    • VS Code at C:\Users\Kent\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[√] Connected device (1 available)
    • Pixel • FA6AF0303979 • android-arm64 • Android 9 (API 28)

! Doctor found issues in 1 category.

Debugging the Java side, I can see that the activity is being recreated, so when onActivityResult is called, authClientInstance is null and the result is never forwarded to it.

I tried changing initializeAuthClient to this:

private TwitterAuthClient initializeAuthClient(String consumerKey, String consumerSecret) {
    if (authClientInstance == null) {
        authClientInstance = configureClient(consumerKey, consumerSecret);
    }

    return authClientInstance;
}

I updated the call sites but also changed onActivityResult to call it with my hard-coded key and secret (didn't know how to get them otherwise). This behaved in exactly the same way except that there is no longer an "Authorize already in progress" error when I try the second time.

🤔 Any ideas?

Handling API keys

As long as this plugin requires the consumer key and the consumer secret in order to build a TwitterLogin instance, which is the best way to handle this situation? How secure is to hardcode those keys? Could be dangerous exposing them in a version control system?

Thanks in advance

While using this plugin it shows some error

A problem occurred evaluating root project 'firebase_auth'. > Could not find the firebase_core FlutterFire plugin, have you added it as a dependency in your pubspec?

Can you please find me what is the error in it

Improve documentation for currentSession getter

This line:

This could be useful for logging in the user automatically in the case where you don't persist the session in your Flutter app yourself.

might give the users the impression that they have to persist the Twitter sessions manually by themselves. This isn't most likely the case: the Twitter SDK should remember the login.

TwitterLoginPlugin.java uses or overrides a deprecated API.

Hi, I am testing the Plugin without issues at Android virtual device but are you planning to correct this deprecated API warning?

Note: C:\Users\martinwo\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_twitter-1.1.3\android\src\main\java\com\roughike\fluttertwitterlogin\fluttertwitterlogin\TwitterLoginPlugin.java uses or overrides a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

Note: C:\Users\martinwo\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\url_launcher-5.4.5\android\src\main\java\io\flutter\plugins\urllauncher\WebViewActivity.java uses or overrides a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

Twitter login exception iOS

It's working with Android but i get a trouble when login with iOS.

 `<key>CFBundleURLTypes</key>
  <array>
  <dict>
      <key>CFBundleTypeRole</key>
      <string>Editor</string>
      <key>CFBundleURLSchemes</key>
       <array>
        <string>twitterkit-mmjB8lbQe3wsBhx*********></string>
      </array>
     </dict>
    <dict>
     <key>CFBundleTypeRole</key>
     <string>Editor</string>
     <key>CFBundleURLSchemes</key>
     <array>
        <string>fb26143136******</string>
     </array>
   </dict>
   <dict>
    <key>CFBundleTypeRole</key>
    <string>Editor</string>
    <key>CFBundleURLSchemes</key>
     <array>
        <string>com.googleusercontent.apps.433638145101-40qg2d9uiq4v5t*********</string>
      </array>
      </dict>

</array>

<key>LSApplicationQueriesSchemes</key>
<array>
     <string>twitter</string>
    <string>twitterauth</string>
    <string>fbapi</string>
    <string>fb-messenger-share-api</string>
    <string>fbauth2</string>
    <string>fbshareextension</string>

</array>`

Exception.........

 (
0   CoreFoundation      0x00007fff23baa1ee       __exceptionPreprocess + 350
1   libobjc.A.dylib          0x00007fff50864b20    objc_exception_throw + 48
2   CoreFoundation      0x00007fff23baa02c +[NSException raise:format:] + 188
3   TwitterKit                 0x0000000106df38ad -[TWTRTwitter logInWithViewController:completion:] + 649
4   Runner          0x00000001023ded4d -[TwitterLoginPlugin authorize:] + 205
5   Runner         0x00000001023de83f -[TwitterLoginPlugin handleMethodCall:result:] + 335
6   Flutter       0x0000000104d0d4fd __45-[FlutterMethodChannel setMethodCallHandler:]<…>

Lost connection to device.

Specs satisfying the `flutter_twitter (from `.symlinks/plugins/flutter_twitter/ios`)` dependency were found, but they required a higher minimum deployment target.

Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
flutter: 0
Running pod install...
CocoaPods' output:

Preparing

Analyzing dependencies

Inspecting targets to integrate
  Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)

Finding Podfile changes
  A flutter_twitter
  - Flutter
  - connectivity
  - flutter_web_view
  - image_picker
  - path_provider

Fetching external sources
-> Fetching podspec for `Flutter` from `.symlinks/flutter/ios`
-> Fetching podspec for `connectivity` from `.symlinks/plugins/connectivity/ios`
-> Fetching podspec for `flutter_twitter` from `.symlinks/plugins/flutter_twitter/ios`
-> Fetching podspec for `flutter_web_view` from `.symlinks/plugins/flutter_web_view/ios`
-> Fetching podspec for `image_picker` from `.symlinks/plugins/image_picker/ios`
-> Fetching podspec for `path_provider` from `.symlinks/plugins/path_provider/ios`

Resolving dependencies of `Podfile`
  CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only perfomed in repo update
[!] CocoaPods could not find compatible versions for pod "flutter_twitter":
  In Podfile:
    flutter_twitter (from `.symlinks/plugins/flutter_twitter/ios`)

Specs satisfying the `flutter_twitter (from `.symlinks/plugins/flutter_twitter/ios`)` dependency were found, but they required a higher minimum deployment target.

/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:328:in `raise_error_unless_state'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:310:in `block in unwind_for_conflict'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:308:in `tap'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:308:in `unwind_for_conflict'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:684:in `attempt_to_activate'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:254:in `process_topmost_state'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:182:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolver.rb:43:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/resolver.rb:94:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/analyzer.rb:986:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/analyzer.rb:984:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:410:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:234:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:233:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:156:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.4/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'

Error output from CocoaPods:

[!] Automatically assigning platform `iOS` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

Error running pod install
Error launching application on iPhone 11 Pro Max.

version: flutter_twitter: ^1.1.3

Info.Plist

<key>CFBundleURLTypes</key>
<array>
  <dict>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>twitterkit-HPjTlQ.....</string>
    </array>
  </dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>twitter</string>
    <string>twitterauth</string>
</array>

Login goes through webview instead of app?

As the title says, I can't get this package to open the Twitter app and run the login flow through there even though it's installed. Is anyone else experiencing this issue?

I tried it on the main repo (this one) and also on a fork (https://github.com/sabreys/flutter_twitter_login) and both have the same behavior - just wondering if I'm missing something as the docs on TwitterLogin.authorize() say the following:

/// Logs the user in. /// /// If the user has a native Twitter client installed, this will present a /// native login screen. Otherwise a WebView is used.

Can't build release APK

When I run flutter build apk it produces the following error


* What went wrong:
A problem occurred configuring root project 'flutter_twitter_login'.
> Failed to notify project evaluation listener.
   > org.gradle.api.tasks.compile.CompileOptions.setBootClasspath(Ljava/lang/String;)V

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 7s


The plugin flutter_twitter could not be built due to the issue above.

I've tried to migrate to Androidx using Android Studio but got the same error.

Steps to reproduce

  • Create a new flutter project
  • add flutter_twitter: ^1.1.3 to dependencies in pubspec.yaml
  • run flutter build apk

flutter doctor output

[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Linux, locale en_US.UTF-8)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Android Studio (version 3.6)
[!] IntelliJ IDEA Community Edition (version 2019.3)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.43.2)
[✓] Connected device (1 available)

Thanks in advance.

Getting "java.lang.IllegalStateException: Reply already submitted" when trying to sign in

Recently I had an app crash caught by Firebase Crashlytics when trying to perform Sign in with twitter on Android 10. Here's the exception log:

Fatal Exception: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=140, result=1, data=Intent { (has extras) }} to activity {com.snapnlook.app/com.snapnlook.app.MainActivity}: java.lang.IllegalStateException: Reply already submitted
       at android.app.ActivityThread.deliverResults(ActivityThread.java:5471)
       at android.app.ActivityThread.handleSendResult(ActivityThread.java:5512)
       at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
       at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:103)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2386)
       at android.os.Handler.dispatchMessage(Handler.java:107)
       at android.os.Looper.loop(Looper.java:213)
       at android.app.ActivityThread.main(ActivityThread.java:8178)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)

Here's the Stack trace:

Caused by java.lang.IllegalStateException: Reply already submitted
       at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:35)
       at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.a(MethodChannel.java:14)
       at com.roughike.fluttertwitterlogin.fluttertwitterlogin.TwitterLoginPlugin.a(TwitterLoginPlugin.java:11)
       at com.twitter.sdk.android.core.identity.TwitterAuthClient$CallbackWrapper.a(TwitterAuthClient.java:13)
       at com.twitter.sdk.android.core.identity.AuthHandler.a(AuthHandler.java:85)
       at com.twitter.sdk.android.core.identity.TwitterAuthClient.a(TwitterAuthClient.java:61)
       at com.roughike.fluttertwitterlogin.fluttertwitterlogin.TwitterLoginPlugin.a(TwitterLoginPlugin.java:4)
       at io.flutter.embedding.engine.FlutterEnginePluginRegistry$FlutterEngineActivityPluginBinding.a(FlutterEnginePluginRegistry.java:20)
       at io.flutter.embedding.engine.FlutterEnginePluginRegistry.a(FlutterEnginePluginRegistry.java:15)
       at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.a(FlutterActivityAndFragmentDelegate.java:51)
       at io.flutter.embedding.android.FlutterActivity.onActivityResult(FlutterActivity.java:2)
       at android.app.Activity.dispatchActivityResult(Activity.java:8413)
       at android.app.ActivityThread.deliverResults(ActivityThread.java:5464)
       at android.app.ActivityThread.handleSendResult(ActivityThread.java:5512)
       at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
       at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:103)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2386)
       at android.os.Handler.dispatchMessage(Handler.java:107)
       at android.os.Looper.loop(Looper.java:213)
       at android.app.ActivityThread.main(ActivityThread.java:8178)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)

The output of my Flutter doctor:

[√] Flutter (Channel stable, v1.17.1, on Microsoft Windows [versão 10.0.18362.836], locale pt-BR)
    • Flutter version 1.17.1 at C:\flutter
    • Framework revision f7a6a7906b (11 days ago), 2020-05-12 18:39:00 -0700
    • Engine revision 6bc433c6b6
    • Dart version 2.8.2


[√] Android toolchain - develop for Android devices (Android SDK version 30.0.0-rc1)
    • Android SDK at C:\Users\Usuario\AppData\Local\Android\sdk
    • Platform android-29, build-tools 30.0.0-rc1
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
    • All Android licenses accepted.

[√] Android Studio (version 3.6)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 45.1.1
    • Dart plugin version 192.8052
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[√] VS Code (version 1.45.1)
    • VS Code at C:\Users\Usuario\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.10.1

[√] Connected device (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 6.0 (API 23) (emulator)

• No issues found!

Examples of functions

Can someone please give me simple examples of functions mentioned in sourse code, especially fetchTweets() and sendTokenAndSecretToServer()?

Migrating the plugin to the V2 embedding

The plugin flutter_twitter_login uses a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.

Hello friend first thanks for sharing this library, I'm using it in my project and after updating to flutter 3 I'm getting the above warning, is there any intention to update the library to flutter 3?

Update your code

New apps that use UIWebView are no longer accepted. Instead, use WKWebView for improved security and reliability.

Example returns error

Hi.

I cloned the example, changed nothing and ran it on genymotion. When tapping on "Log in" it opens the web browser and then goes back to the app with an error:

"Failed to get request token".

I have tried this with my twitter credentials as well, same error.

I also tried your plugin with Firebase & Flutter, and I got an error saying that no callback url was specified.

I know that with my React Native apps, I needed to specify a callback URL (using Firebase) on Twitter and then also update my android AndroidManifest.xml to support it.

So I am not sure if that's the case here or not?

iOS example fails with error in emulator

After compiling and running the example application on the iOS 11.4 emulator, clicking the "Log In" button will fail with this error:

[TwitterKit] did encounter error with message "Unable to authenticate using the system account.": Error Domain=TWTRLogInErrorDomain Code=0 "User denied access to system accounts." UserInfo={NSLocalizedDescription=User denied access to system accounts., NSLocalizedRecoverySuggestion=Give this user access to the System Twitter account.}
[TwitterKit] No matching scheme found.
[TwitterKit] did encounter error with message "Error obtaining user auth token.": Error Domain=TWTRLogInErrorDomain Code=-1 "Callback URL not approved for this client application. Approved callback URLs can be adjusted in your application settings" UserInfo={NSLocalizedDescription=Callback URL not approved for this client application. Approved callback URLs can be adjusted in your application settings}

I've tried replacing the consumer key and secret with my own, and I receive the same error above.

Here's my flutter doctor -v

$ flutter doctor -v
[✓] Flutter (Channel beta, v0.5.1, on Mac OS X 10.13.5 17F77, locale en-US)
    • Flutter version 0.5.1 at /Volumes/New/flutter
    • Framework revision c7ea3ca377 (6 weeks ago), 2018-05-29 21:07:33 +0200
    • Engine revision 1ed25ca7b7
    • Dart version 2.0.0-dev.58.0.flutter-f981f09760

[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at /Users/alex/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-27, build-tools 27.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 9.4.1, Build version 9F2000
    • ios-deploy 1.9.2
    • CocoaPods version 1.5.3

[✓] Android Studio (version 3.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 26.0.1
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[!] VS Code (version 1.25.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected devices (1 available)
    • iPhone X • 26335CBA-34C8-44E6-BF80-A75703FB2F8F • ios • iOS 11.4 (simulator)

! Doctor found issues in 1 category.

Bug on compilation

Just after adding twitter in the pubspec like this flutter_twitter: ^1.1.3 then I compile for Android I have this error:

Launching lib/main_dev.dart on Android SDK built for x86 in debug mode...
D8: Cannot fit requested classes in a single dex file (# methods: 67953 > 65536)
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: 
The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
	at com.android.builder.dexing.D8DexArchiveMerger.getExceptionToRethrow(D8DexArchiveMerger.java:131)
	at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:118)
	at com.android.build.gradle.internal.transforms.DexMergerTransformCallable.call(DexMergerTransformCallable.java:102)
	at com.android.build.gradle.internal.tasks.DexMergingTaskRunnable.run(DexMergingTask.kt:444)
	at com.android.build.gradle.internal.tasks.Workers$ActionFacade.run(Workers.kt:335)
	at org.gradle.workers.internal.AdapterWorkAction.execute(AdapterWorkAction.java:50)
	at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:47)
	at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1$1.create(NoIsolationWorkerFactory.java:65)
	at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1$1.create(NoIsolationWorkerFactory.java:61)
	at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:98)
	at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.execute(NoIsolationWorkerFactory.java:61)
	at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
	at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
	at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
	at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
	at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:56)
	at org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:215)
	at org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:210)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:215)
	at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:164)
	at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:131)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
	at java.lang.Thread.run(Thread.java:748)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
	at com.android.tools.r8.utils.t.a(:55)
	at com.android.tools.r8.D8.run(:11)
	at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:116)
	... 34 more
Caused by: com.android.tools.r8.utils.AbortException: Error: null, Cannot fit requested classes in a single dex file (# methods: 67953 > 65536)
	at com.android.tools.r8.utils.Reporter.a(:21)
	at com.android.tools.r8.utils.Reporter.a(:7)
	at com.android.tools.r8.dex.VirtualFile.a(:33)
	at com.android.tools.r8.dex.VirtualFile$h.a(:5)
	at com.android.tools.r8.dex.ApplicationWriter.a(:13)
	at com.android.tools.r8.dex.ApplicationWriter.write(:35)
	at com.android.tools.r8.D8.d(:44)
	at com.android.tools.r8.D8.b(:1)
	at com.android.tools.r8.utils.t.a(:23)
	... 36 more


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDexDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: 
     The number of method references in a .dex file cannot exceed 64K.
     Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 14s
[!] The shrinker may have failed to optimize the Java bytecode.
    To disable the shrinker, pass the `--no-shrink` flag to this command.
    To learn more, see: https://developer.android.com/studio/build/shrink-code
Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

Flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, v1.12.17-pre.17, on Mac OS X 10.15.1 19B88, locale en-FR)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.40.2)
[✓] Connected device (4 available)

! Doctor found issues in 1 category.

Exception throw when login in IOS

From @lucyhoang on September 17, 2018 10:32

URL: https://pub.dartlang.org/packages/flutter_twitter_login#-versions-tab-

Hi, i am trying to use this packages.
But i get a trouble when login with ios.
I create an app on twitter, setting callbacks are : twitterkit-consumerKey:// (for ios) and twittersdk:// (for android)
Then i use your example to run. It's run well on android.
But i got exception on IOS when click to "Login"
Here is exception:

0 CoreFoundation 0x00000001121051e6 __exceptionPreprocess + 294
1 libobjc.A.dylib 0x00000001117a2031 objc_exception_throw + 48
2 CoreFoundation 0x000000011217a975 +[NSException raise:format:] + 197
3 TwitterKit 0x000000010f3eb922 -[TWTRTwitter logInWithViewController:completion:] + 655
4 flutter_twitter_login 0x000000010b7cec7e -[TwitterLoginPlugin authorize:] + 206
5 flutter_twitter_login 0x000000010b7ce7a6 -[TwitterLoginPlugin handleMethodCall:result:] + 326
6 Flutter 0x000000010cda7a42 __45-[FlutterMethodChannel setMethodCallHandler:]<…>

Could you check it for me. Thanks

Copied from original issue: dart-lang/pub-dev#1619

I want to know when there are multiple CallbackURLs

Currently, we are implementing a login function using TwitterApp.

And this TwitterApp has multiple callback urls.

However, I did not know how to set it to use one callback url.

Could you tell me if there are people who understand it?

Issue while create release apk

  • What went wrong:
    Execution failed for task ':flutter_twitter_login:verifyReleaseResources'.

java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
C:\Users\Shubham\AndroidStudioProjects\go_flite_12_12\build\flutter_twitter_login\intermediates\res\merged\release\values\values.xml:247: error: resource android:attr/fontVariationSettings not found.
C:\Users\Shubham\AndroidStudioProjects\go_flite_12_12\build\flutter_twitter_login\intermediates\res\merged\release\values\values.xml:248: error: resource android:attr/ttcIndex not found.
error: failed linking references.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 4m 59s
Finished with error: Gradle task assembleRelease failed with exit code 1

Cannot build it

Cannot build with following output:

Xcode's output:
↳
    === BUILD TARGET flutter_twitter_login OF PROJECT Pods WITH CONFIGURATION Debug ===
    /Users/tr/Documents/Projects/RDev/Art-Is-Heart/ArtIsHeart-Flutter/App/art_is_heart/ios/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.m:133:17: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
                    _view.frame = CGRectMake(0.0, 0.0, CGRectGetWidth(_view.bounds), 0.0);
                    ^
                    self->
    /Users/tr/Documents/Projects/RDev/Art-Is-Heart/ArtIsHeart-Flutter/App/art_is_heart/ios/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.m:133:67: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
                    _view.frame = CGRectMake(0.0, 0.0, CGRectGetWidth(_view.bounds), 0.0);
                                                                      ^
                                                                      self->
    /Users/tr/Documents/Projects/RDev/Art-Is-Heart/ArtIsHeart-Flutter/App/art_is_heart/ios/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.m:148:18: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
                    [_view sizeToFit];
                     ^
                     self->
    /Users/tr/Documents/Projects/RDev/Art-Is-Heart/ArtIsHeart-Flutter/App/art_is_heart/ios/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.m:189:13: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
            if (_navigationController) {
                ^
                self->
    /Users/tr/Documents/Projects/RDev/Art-Is-Heart/ArtIsHeart-Flutter/App/art_is_heart/ios/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.m:190:40: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
                [self updateNavigationBarY:_view.statusBarHeight];
                                           ^
                                           self->
    /Users/tr/Documents/Projects/RDev/Art-Is-Heart/ArtIsHeart-Flutter/App/art_is_heart/ios/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.m:193:24: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
            CGRect frame = _view.frame;
                           ^
                           self->
    /Users/tr/Documents/Projects/RDev/Art-Is-Heart/ArtIsHeart-Flutter/App/art_is_heart/ios/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.m:195:9: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
            _view.frame = frame;
            ^
            self->
    /Users/tr/Documents/Projects/RDev/Art-Is-Heart/ArtIsHeart-Flutter/App/art_is_heart/ios/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.m:203:17: warning: block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior [-Wimplicit-retain-self]
                    _view.closed = YES;
                    ^
                    self->
    8 warnings generated.
    /Users/tr/Documents/Projects/RDev/Art-Is-Heart/ArtIsHeart-Flutter/App/art_is_heart/ios/Pods/TwitterCore/iOS/TwitterCore.framework/Modules/module.private.modulemap:1:29: warning: private submodule 'TwitterCore.Private' in private module map, expected top-level module [-Wprivate-module]
    explicit module TwitterCore.Private {
                                ^
    /Users/tr/Documents/Projects/RDev/Art-Is-Heart/ArtIsHeart-Flutter/App/art_is_heart/ios/Pods/TwitterCore/iOS/TwitterCore.framework/Modules/module.private.modulemap:1:29: note: rename 'TwitterCore.Private' to ensure it can be found by name
    explicit module TwitterCore.Private {
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
    framework module TwitterCore_Private
    /Users/tr/Documents/Projects/RDev/Art-Is-Heart/ArtIsHeart-Flutter/App/art_is_heart/ios/Pods/TwitterCore/iOS/TwitterCore.framework/Modules/module.private.modulemap:1:29: warning: private submodule 'TwitterCore.Private' in private module map, expected top-level module [-Wprivate-module]
    explicit module TwitterCore.Private {
                                ^
    /Users/tr/Documents/Projects/RDev/Art-Is-Heart/ArtIsHeart-Flutter/App/art_is_heart/ios/Pods/TwitterCore/iOS/TwitterCore.framework/Modules/module.private.modulemap:1:29: note: rename 'TwitterCore.Private' to ensure it can be found by name
    explicit module TwitterCore.Private {
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
    framework module TwitterCore_Private
    /Users/tr/Documents/Projects/RDev/Art-Is-Heart/ArtIsHeart-Flutter/App/art_is_heart/ios/Pods/TwitterCore/iOS/TwitterCore.framework/Modules/module.private.modulemap:1:29: warning: private submodule 'TwitterCore.Private' in private module map, expected top-level module [-Wprivate-module]
    explicit module TwitterCore.Private {
                                ^
    /Users/tr/Documents/Projects/RDev/Art-Is-Heart/ArtIsHeart-Flutter/App/art_is_heart/ios/Pods/TwitterCore/iOS/TwitterCore.framework/Modules/module.private.modulemap:1:29: note: rename 'TwitterCore.Private' to ensure it can be found by name
    explicit module TwitterCore.Private {
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
    framework module TwitterCore_Private
    <module-includes>:1:1: warning: umbrella header for module 'TwitterCore' does not include header 'TWTRColorUtil.h' [-Wincomplete-umbrella]
    #import "Headers/TwitterCore.h"
    ^
    2 warnings generated.
    3 warnings generated.
    4 warnings generated.
    Undefined symbols for architecture x86_64:
      "_OBJC_CLASS_$_TWTRAPIClient", referenced from:
          objc-class-ref in TwitterLoginPlugin.o
      "_OBJC_CLASS_$_TWTRTwitter", referenced from:
          objc-class-ref in TwitterLoginPlugin.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

Is there any plan to move this plugin from deprecated TwitterKit to for example https://github.com/mattdonnelly/Swifter

Getting null token from TwitterAuthProvider.credential method

Anyone have any idea why I am getting null token from the credential method?
Below is the value that I get from the method.

TwitterAuth= AuthCredential(providerId: twitter.com, signInMethod: twitter.com, token: null)

Any help will be appreciated.

Thanks!

Twitter login is not working in Web application.

Hi I have used the latest version of plugin for my application to provide twitter authentication. It is working fine in both Android and iOS.

But not working in Web application. Instead it is returning the below message when i tried to execute twitter login code.

`html_dart2js.dart:39777 Overflow on channel: com.roughike/flutter_twitter_login.  Messages on this channel are being discarded in FIFO fashion.  The engine may not be running or you need to adjust the buffer size if of the channel.`

errors.dart:146 Uncaught (in promise) Error: MissingPluginException(No implementation found for method authorize on channel com.roughike/flutter_twitter_login)
    at Object.throw_ [as throw] (errors.dart:195)
    at MethodChannel._invokeMethod (platform_channel.dart:154)
    at _invokeMethod.next (<anonymous>)
    at onValue (async_patch.dart:47)
    at _RootZone.runUnary (zone.dart:1439)
    at _FutureListener.thenAwait.handleValue (future_impl.dart:141)
    at handleValueCallback (future_impl.dart:682)
    at Function._propagateToListeners (future_impl.dart:711)
    at _Future.new.[_completeWithValue] (future_impl.dart:526)
    at async._AsyncCallbackEntry.new.callback (future_impl.dart:556)
    at Object._microtaskLoop (schedule_microtask.dart:43)
    at _startMicrotaskLoop (schedule_microtask.dart:52)
    at async_patch.dart:168

image

Please help me to solve this issue for Web application. Or suggest me any other solution for Web application.

Incompatible with Twitter Kit 3

It seems that flutter_twitter_login 1.1.0 is only compatible with Twitter Kit v2.x, and fails to compile with Twitter Kit v3.x.

This is a blocker for me because other dependencies require that my iOS project has a minimum deployment target of 10.0, which then enforces Twitter Kit v3.x (I'm not proficient at Xcode/iOS development, but this seems to be the reason).

ITMS-90809: Deprecated API Usage UIWebView

ITMS-90809: Deprecated API Usage - Apple will no longer accept submissions of new apps that use UIWebView as of April 30, 2020 and app updates that use UIWebView as of December 2020. Instead, use WKWebView for improved security and reliability. Learn more (https://developer.apple.com/documentation/uikit/uiwebview).

Is anyone can help , I think this package doesn’t have any support any more.

uncaught exception 'TWTRInvalidInitializationException'

When I try to login with Twitter,
The following error will cause the app to fail without catching the error.

2019-08-01 19:31:17.727148+0900 Runner[3661:10446812] *** Terminating app due to uncaught exception 'TWTRInvalidInitializationException', reason: 'Attempt made to Log in or Like a Tweet without a valid Twitter Kit URL Scheme set up in the app settings. Please see https://dev.twitter.com/twitterkit/ios/installation for more info.'
*** First throw call stack:
(
	0   CoreFoundation                      0x00000001161dd8db __exceptionPreprocess + 331
	1   libobjc.A.dylib                     0x0000000115780ac5 objc_exception_throw + 48
	2   CoreFoundation                      0x00000001161dd735 +[NSException raise:format:] + 197
	3   TwitterKit                          0x0000000114d408ad -[TWTRTwitter logInWithViewController:completion:] + 649
	4   Runner                              0x000000010f4e371d -[TwitterLoginPlugin authorize:] + 205
	5   Runner                              0x000000010f4e320f -[TwitterLoginPlugin handleMethodCall:result:] + 335
	6   Flutter                             0x0000000111993c51 __45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke + 104
	7   Flutter                             0x000000011192ef20 _ZNK7flutter21PlatformMessageRouter21HandlePlatformMessageEN3fml6RefPtrINS_15PlatformMessageEEE + 166
	8   Flutter                             0x00000001119326a8 _ZN7flutter15PlatformViewIOS21HandlePlatformMessageEN3fml6RefPtrINS_15PlatformMessageEEE + 38
	9   Flutter                             0x000000011198e7b5 _ZNSt3__110__function6__funcIZN7flutter5Shell29OnEngineHandlePlatformMessageEN3fml6RefPtrINS2_15PlatformMessageEEEE4$_30NS_9allocatorIS8_EEFvvEEclEv + 57
	10  Flutter                             0x00000001119414ed _ZN3fml15MessageLoopImpl10FlushTasksENS_9FlushTypeE + 123
	11  Flutter                             0x0000000111946400 _ZN3fml17MessageLoopDarwin11OnTimerFireEP16__CFRunLoopTimerPS0_ + 26
	12  CoreFoundation                      0x00000001161455b4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
	13  CoreFoundation                      0x00000001161451c2 __CFRunLoopDoTimer + 1026
	14  CoreFoundation                      0x0000000116144a2a __CFRunLoopDoTimers + 266
	15  CoreFoundation                      0x000000011613f0cc __CFRunLoopRun + 2220
	16  CoreFoundation                      0x000000011613e4d2 CFRunLoopRunSpecific + 626
	17  GraphicsServices                    0x000000011954b2fe GSEventRunModal + 65
	18  UIKitCore                           0x000000011f292fc2 UIApplicationMain + 140
	19  Runner                              0x000000010f386ef8 main + 72
	20  libdyld.dylib                       0x000000011726d541 start + 1
	21  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

@roughike

Login with firebase not working

I tried to login with firebase but it's not working ( I tested with android only)

Code

 `final AuthCredential credential = TwitterAuthProvider.getCredential(
       authToken: session.token,
       authTokenSecret: session.secret,
     );
     final AuthResult response =
        await _auth.signInWithCredential(credential);`

Exception

E/AndroidRuntime(17566): FATAL EXCEPTION: main E/AndroidRuntime(17566): Process: com.boffincoders.chat_app, PID: 17566 E/AndroidRuntime(17566): java.lang.IllegalArgumentException: Unsupported value: null E/AndroidRuntime(17566): at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:294) E/AndroidRuntime(17566): at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:291) E/AndroidRuntime(17566): at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:291) E/AndroidRuntime(17566): at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:291) E/AndroidRuntime(17566): at io.flutter.plugin.common.StandardMethodCodec.encodeSuccessEnvelope(StandardMethodCodec.java:57) E/AndroidRuntime(17566): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:225) E/AndroidRuntime(17566): at io.flutter.plugins.firebaseauth.FirebaseAuthPlugin$SignInCompleteListener.onComplete(FirebaseAuthPlugin.java:691) E/AndroidRuntime(17566): at com.google.android.gms.tasks.zzj.run(Unknown Source:4) E/AndroidRuntime(17566): at android.os.Handler.handleCallback(Handler.java:873) E/AndroidRuntime(17566): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime(17566): at android.os.Looper.loop(Looper.java:201) E/AndroidRuntime(17566): at android.app.ActivityThread.main(ActivityThread.java:6823) E/AndroidRuntime(17566): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(17566): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547) E/AndroidRuntime(17566): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873) I/Process (17566): Sending signal. PID: 17566 SIG: 9 Lost connection to device.

After login state not returning to app

Hi, I configured the app as per docs but it's not working properly after login it's not showing user details instead it's showing this page: https://imgur.com/XdW82TU

Here's my flutter doctor:

flutter doctor -v
[✓] Flutter (Channel stable, 2.2.3, on Mac OS X 10.15.1 19B88 darwin-x64, locale en-GB)
• Flutter version 2.2.3 at /Users/mamun/Developer/flutter
• Framework revision f4abaa0735 (9 days ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/mamun/Library/Android/sdk/
• Platform android-30, build-tools 30.0.2
• Java binary at: /Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home/bin/java
• Java version Java(TM) SE Runtime Environment (build 1.8.0_231-b11)
• All Android licenses accepted.

[!] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.3.1, Build version 11C505
✗ Xcode 11.3.1 out of date (12.0.1 is recommended).
Download the latest version or update via the Mac App Store.
! CocoaPods 1.9.1 out of date (1.10.0 is recommended).
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the
Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To upgrade see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[!] Android Studio
• Android Studio at /path/to/android/studio/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
✗ Android Studio not found at /path/to/android/studio/Contents
• Try updating or re-installing Android Studio.

[✓] VS Code (version 1.57.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.24.0

[✓] Connected device (2 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.114

! Doctor found issues in 2 categories.

here's my code:

static Future signInWithTwitter(
{BuildContext? context}) async {
String? newMessage;

// Create a TwitterLogin instance
final TwitterLogin twitterLogin = new TwitterLogin(
  consumerKey: '',
  consumerSecret: '',
);

// Trigger the sign-in flow
final TwitterLoginResult result = await twitterLogin.authorize();

// Get the Logged In session
final TwitterSession twitterSession = result.session;

// Create a credential from the access token
final twitterAuthCredential = TwitterAuthProvider.credential(
  accessToken: twitterSession.token,
  secret: twitterSession.secret,
);

// Once signed in, return the UserCredential
UserCredential userCredential =
    await FirebaseAuth.instance.signInWithCredential(twitterAuthCredential);

log('your message here');
log('userCredential.user');
log(userCredential.user.toString());
User? user = userCredential.user;
DocumentSnapshot? doc = await Globals.userRef.doc(user!.uid).get();
if (!doc.exists) {
  Globals.userRef.doc(user!.uid).set({
    'uid': user!.uid,
    'email': user.email,
    'firstName': "firstName",
    'lastName': "lastName",
    'displayName': user!.displayName,
    'password': 'hashedPassword',
    'userName': user.email,
    'bio': Globals.loremText,
    'photoUrl': user!.photoURL,
    'phoneNumber': "phoneNumber",
    'userType': "Facebook",
    'publicUrl': "url",
    "isAdmin": false,
    'createdAt': FieldValue.serverTimestamp(),
    'updatedAt': FieldValue.serverTimestamp(),
    'lastLoggedIn': FieldValue.serverTimestamp(),
  });

  switch (result.status) {
    case TwitterLoginStatus.loggedIn:
      newMessage = 'User ${user.email} LoggedIn Successfully!';
      ScaffoldMessenger.of(context!).showSnackBar(
        Globals.customSnackBar(
          content: newMessage,
        ),
      );
      break;
    case TwitterLoginStatus.cancelledByUser:
      newMessage = 'Login cancelled by user.';
      ScaffoldMessenger.of(context!).showSnackBar(
        Globals.customSnackBar(
          content: newMessage,
        ),
      );
      break;
    case TwitterLoginStatus.error:
      newMessage = 'Login error: ${result.errorMessage}';
      ScaffoldMessenger.of(context!).showSnackBar(
        Globals.customSnackBar(
          content: newMessage,
        ),
      );
      break;
  }
}
Navigator.push(
    context!,
    MaterialPageRoute(
        builder: (context) => WelcomeScreen(
              user: user,
            )));
return userCredential;

}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.