Clancey / simple_auth

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

So I need to handle this better. This is caused by a null redirect url. You need something in the redirect or this error happens. #105

Open rakhimian opened 5 years ago

rakhimian commented 5 years ago

So I need to handle this better. This is caused by a null redirect url. You need something in the redirect or this error happens.

_Originally posted by @Clancey in https://github.com/Clancey/simple_auth/issues/27#issuecomment-426885594_

Hi! let say I've some redirect url. Where I should set them? Thanks!

rakhimian commented 5 years ago

Please find logging below:

Performing hot restart... Syncing files to device ASUS Z00LD... Restarted application in 3 076ms. E/MethodChannel#simple_auth_flutter/showAuthenticator(24407): Failed to handle method call E/MethodChannel#simple_auth_flutter/showAuthenticator(24407): java.lang.IllegalArgumentException: Unsupported value: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.String.toLowerCase()' on a null object reference E/MethodChannel#simple_auth_flutter/showAuthenticator(24407): at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:294) E/MethodChannel#simple_auth_flutter/showAuthenticator(24407): at io.flutter.plugin.common.StandardMethodCodec.encodeErrorEnvelope(StandardMethodCodec.java:70) E/MethodChannel#simple_auth_flutter/showAuthenticator(24407): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.error(MethodChannel.java:230) E/MethodChannel#simple_auth_flutter/showAuthenticator(24407): at clancey.simpleauth.simpleauthflutter.SimpleAuthFlutterPlugin.onMethodCall(SimpleAuthFlutterPlugin.java:63) E/MethodChannel#simple_auth_flutter/showAuthenticator(24407): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:222) E/MethodChannel#simple_auth_flutter/showAuthenticator(24407): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:96) E/MethodChannel#simple_auth_flutter/showAuthenticator(24407): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:643) E/MethodChannel#simple_auth_flutter/showAuthenticator(24407): at android.os.MessageQueue.nativePollOnce(Native Method) E/MethodChannel#simple_auth_flutter/showAuthenticator(24407): at android.os.MessageQueue.next(MessageQueue.java:323) E/MethodChannel#simple_auth_flutter/showAuthenticator(24407): at android.os.Looper.loop(Looper.java:135) E/MethodChannel#simple_auth_flutter/showAuthenticator(24407): at android.app.ActivityThread.main(ActivityThread.java:5451) E/MethodChannel#simple_auth_flutter/showAuthenticator(24407): at java.lang.reflect.Method.invoke(Native Method) E/MethodChannel#simple_auth_flutter/showAuthenticator(24407): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) E/MethodChannel#simple_auth_flutter/showAuthenticator(24407): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) E/flutter (24407): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: PlatformException(error, Unsupported value: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.String.toLowerCase()' on a null object reference, null) E/flutter (24407): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:564:7) E/flutter (24407): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:316:33) E/flutter (24407): E/flutter (24407): #2 SimpleAuthFlutter.showAuthenticator (package:simple_auth_flutter/simple_auth_flutter.dart:33:33) E/flutter (24407): E/flutter (24407): #3 OAuthApi.performAuthenticate (package:simple_auth/src/oauth/oauthApi.dart:86:30) E/flutter (24407): E/flutter (24407): #4 AuthenticatedApi.authenticate (package:simple_auth/src/api/authenticatedApi.dart:20:54) E/flutter (24407): E/flutter (24407): #5 _MyHomePageState.login (package:api_auth/main.dart:348:31) E/flutter (24407): E/flutter (24407): #6 _MyHomePageState.build. (package:api_auth/main.dart:86:15) E/flutter (24407): #7 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:635:14) E/flutter (24407): #8 _InkResponseState.build. (package:flutter/src/material/ink_well.dart:711:32) E/flutter (24407): #9 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24) E/flutter (24407): #10 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:365:11) E/flutter (24407): #11 TapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:312:7) E/flutter (24407): #12 GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:156:27) E/flutter (24407): #13 _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:222:20) E/flutter (24407): #14 _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:198:22) E/flutter (24407): #15 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156:7) E/flutter (24407): #16 _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102:7) E/flutter (24407): #17 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86:7) E/flutter (24407): #18 _rootRunUnary (dart:async/zone.dart:1136:13) E/flutter (24407): #19 _CustomZone.runUnary (dart:async/zone.dart:1029:19) E/flutter (24407): #20 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7) E/flutter (24407): #21 _invoke1 (dart:ui/hooks.dart:250:10) E/flutter (24407): #22 _dispatchPointerDataPacket (dart:ui/hooks.dart:159:5) E/flutter (24407):

CoreyCole commented 5 years ago

I'm getting a similar error and my redirectUrl is not null

E/MethodChannel#simple_auth_flutter/showAuthenticator( 8185): Failed to handle method call
E/MethodChannel#simple_auth_flutter/showAuthenticator( 8185): java.lang.IllegalArgumentException: Unsupported value: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.String.toLowerCase()' on a null object reference
E/MethodChannel#simple_auth_flutter/showAuthenticator( 8185):   at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:294)
E/MethodChannel#simple_auth_flutter/showAuthenticator( 8185):   at io.flutter.plugin.common.StandardMethodCodec.encodeErrorEnvelope(StandardMethodCodec.java:70)
E/MethodChannel#simple_auth_flutter/showAuthenticator( 8185):   at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.error(MethodChannel.java:230)
E/MethodChannel#simple_auth_flutter/showAuthenticator( 8185):   at clancey.simpleauth.simpleauthflutter.SimpleAuthFlutterPlugin.onMethodCall(SimpleAuthFlutterPlugin.java:63)
E/MethodChannel#simple_auth_flutter/showAuthenticator( 8185):   at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:222)
E/MethodChannel#simple_auth_flutter/showAuthenticator( 8185):   at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:96)
E/MethodChannel#simple_auth_flutter/showAuthenticator( 8185):   at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:656)
E/MethodChannel#simple_auth_flutter/showAuthenticator( 8185):   at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#simple_auth_flutter/showAuthenticator( 8185):   at android.os.MessageQueue.next(MessageQueue.java:326)
E/MethodChannel#simple_auth_flutter/showAuthenticator( 8185):   at android.os.Looper.loop(Looper.java:181)
E/MethodChannel#simple_auth_flutter/showAuthenticator( 8185):   at android.app.ActivityThread.main(ActivityThread.java:7045)
E/MethodChannel#simple_auth_flutter/showAuthenticator( 8185):   at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#simple_auth_flutter/showAuthenticator( 8185):   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/MethodChannel#simple_auth_flutter/showAuthenticator( 8185):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)

It is unclear what is null from the error. It'd be great if the plugin told me what was null.