flutter_twitter_login icon indicating copy to clipboard operation
flutter_twitter_login copied to clipboard

Login with firebase not working

Open DesortsSolution opened this issue 6 years ago • 3 comments

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.

DesortsSolution avatar Nov 11 '19 06:11 DesortsSolution

having the same issue

var twitterLogin = new TwitterLogin(
        consumerKey: twitterKeys['api_key'],
        consumerSecret: twitterKeys['secret_key']);

    final TwitterLoginResult result = await twitterLogin.authorize();

    switch (result.status) {
      case TwitterLoginStatus.loggedIn:
        debugPrint("Twitter login Success");
        var session = result.session;
        AuthCredential authCredential = TwitterAuthProvider.getCredential(
            authToken: session.token, authTokenSecret: session.secret);

        AuthResult authResult =
            await _auth.signInWithCredential(authCredential);
        firebaseUser = authResult.user;

        await updateUserData(linkedTwitter: true);

        return firebaseUser;
        break;
      case TwitterLoginStatus.cancelledByUser:
        throw (result.errorMessage);
        break;
      case TwitterLoginStatus.error:
        throw (result.errorMessage);
        break;
    }

    return null;

Error log

E/AndroidRuntime(10330): java.lang.IllegalArgumentException: Unsupported value: null
E/AndroidRuntime(10330): 	at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:294)
E/AndroidRuntime(10330): 	at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:291)
E/AndroidRuntime(10330): 	at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:291)
E/AndroidRuntime(10330): 	at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:291)
E/AndroidRuntime(10330): 	at io.flutter.plugin.common.StandardMethodCodec.encodeSuccessEnvelope(StandardMethodCodec.java:57)
E/AndroidRuntime(10330): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:225)
E/AndroidRuntime(10330): 	at io.flutter.plugins.firebaseauth.FirebaseAuthPlugin$SignInCompleteListener.onComplete(FirebaseAuthPlugin.java:691)
E/AndroidRuntime(10330): 	at com.google.android.gms.tasks.zzj.run(Unknown Source:4)
E/AndroidRuntime(10330): 	at android.os.Handler.handleCallback(Handler.java:873)
E/AndroidRuntime(10330): 	at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(10330): 	at android.os.Looper.loop(Looper.java:193)
E/AndroidRuntime(10330): 	at android.app.ActivityThread.main(ActivityThread.java:6669)
E/AndroidRuntime(10330): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(10330): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/AndroidRuntime(10330): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

iamvivekkaushik avatar Nov 16 '19 12:11 iamvivekkaushik

This is not an issue with this package. This is an issue with flutter/engine. A fix has been merged into flutter engine, however, it is not available in the stable channel. Flutter stable is released quarterly. Hopefully the next stable release will have a fix for this.

Please see https://github.com/flutter/flutter/issues/37681 to learn how to make a temporary fix if Android development is essential to your app now. @roughike I recommend closing this issue.

Fallenstedt avatar Nov 18 '19 03:11 Fallenstedt

I too got the same issue with this Package... " java.lang.IllegalArgumentException: Unsupported value: null".

I had Upgraded flutter engine.. But still getting the error

lithinthomas1996 avatar Dec 06 '19 10:12 lithinthomas1996