Clancey / simple_auth

The Simplest way to Authenticate in Flutter
MIT License
352 stars 108 forks source link

Error on redirect from the browser #101

Closed isgj closed 5 years ago

isgj commented 5 years ago

After a successful login the browser tries to redirect to the flutter app. On some emulators it works, on one that has a default browser it errors. Android 6 (API 23).

Here are the logs:

I/flutter ( 5737): Bad state: Future already completed
E/flutter ( 5737): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: Bad state: Future already completed
E/flutter ( 5737): #0      _Completer.completeError  (dart:async/future_impl.dart:21:31)
E/flutter ( 5737): #1      Authenticator.onError 
package:simple_auth/…/api/authenticator.dart:38
E/flutter ( 5737): #2      SimpleAuthFlutter.init.<anonymous closure> 
package:simple_auth_flutter/simple_auth_flutter.dart:76
E/flutter ( 5737): #3      _rootRunUnary  (dart:async/zone.dart:1132:38)
E/flutter ( 5737): #4      _CustomZone.runUnary  (dart:async/zone.dart:1029:19)
E/flutter ( 5737): #5      _CustomZone.runUnaryGuarded  (dart:async/zone.dart:931:7)
E/flutter ( 5737): #6      _BufferingStreamSubscription._sendData  (dart:async/stream_impl.dart:336:11)
E/flutter ( 5737): #7      _BufferingStreamSubscription._add  (dart:async/stream_impl.dart:263:7)
E/flutter ( 5737): #8      _ForwardingStreamSubscription._add  (dart:async/stream_pipe.dart:132:11)
E/flutter ( 5737): #9      _MapStream._handleData  (dart:async/stream_pipe.dart:232:10)
E/flutter ( 5737): #10     _ForwardingStreamSubscription._handleData  (dart:async/stream_pipe.dart:164:13)
E/flutter ( 5737): #11     _rootRunUnary  (dart:async/zone.dart:1132:38)
E/flutter ( 5737): #12     _CustomZone.runUnary  (dart:async/zone.dart:1029:19)
E/flutter ( 5737): #13     _CustomZone.runUnaryGuarded  (dart:async/zone.dart:931:7)
E/flutter ( 5737): #14     _BufferingStreamSubscription._sendData  (dart:async/stream_impl.dart:336:11)
E/flutter ( 5737): #15     _DelayedData.perform  (dart:async/stream_impl.dart:591:14)
E/flutter ( 5737): #16     _StreamImplEvents.handleNext  (dart:async/stream_impl.dart:707:11)
E/flutter ( 5737): #17     _PendingEvents.schedule.<anonymous closure>  (dart:async/stream_impl.dart:667:7)
E/flutter ( 5737): #18     _rootRun  (dart:async/zone.dart:1120:38)
E/flutter ( 5737): #19     _CustomZone.run  (dart:async/zone.dart:1021:19)
E/flutter ( 5737): #20     _CustomZone.runGuarded  (dart:async/zone.dart:923:7)
E/flutter ( 5737): #21     _CustomZone.bindCallbackGuarded.<anonymous closure>  (dart:async/zone.dart:963:23)
E/flutter ( 5737): #22     _rootRun  (dart:async/zone.dart:1124:13)
E/flutter ( 5737): #23     _CustomZone.run  (dart:async/zone.dart:1021:19)
E/flutter ( 5737): #24     _CustomZone.runGuarded  (dart:async/zone.dart:923:7)
E/flutter ( 5737): #25     _CustomZone.bindCallbackGuarded.<anonymous closure>  (dart:async/zone.dart:963:23)
E/flutter ( 5737): #26     _microtaskLoop  (dart:async/schedule_microtask.dart:41:21)
E/flutter ( 5737): #27     _startMicrotaskLoop  (dart:async/schedule_microtask.dart:50:5)
isgj commented 5 years ago

I noticed that on real devices when the app is build in debug mode it won't redirect, in release mode it works. Probably should close this issue.