flutter_web_auth
flutter_web_auth copied to clipboard
MissingPluginException (MissingPluginException(No implementation found for method authenticate on channel flutter_web_auth))
Hi everyone,
I'm getting this error when trying to authenticate on a 3rd party server on iOS platform. On Android same authentication workflow is working just fine.
The error is a little misleading, because the plugin does contain both the method channel and the native "authenticate()" method implementation for iOS on its corresponding Swift class.
Using flutter_web_auth: ^0.4.1
Any help will be appreciated.
Thanks!
It seems like something has gone wrong when generating the iOS part of your project. This library has support for both iOS and Android.
Unfortunately I don't have too much experience with the inner workings of Flutter. I would recommend googling generic MissingPluginException errors and see if there are any solutions...
This might happen when passing in a url which cannot be parsed into a Uri on iOS. Parsing the url string in a Uri object is done in the same if check as checking the called method name which results in this very confusing error message.
In my case I had an encoding error in the querystring which worked fine on Android but iOS didn't want to parse the url into an Uri. It took me a little while that the incorrect url caused the MissingPluginException... Would have been nice to get a more clear error message.
@koenmuilwijk that's very interesting, could you link the code where this is happening?
I would be happy to accept a PR for a better error message!
@LinusU it's in SwiftFlutterWebAuthPlugin on line 17.
if call.method == "authenticate",
let arguments = call.arguments as? Dictionary<String, AnyObject>,
let urlString = arguments["url"] as? String,
let url = URL(string: urlString), // <---- if this fails it will return result(FlutterMethodNotImplemented) on line 90
let callbackURLScheme = arguments["callbackUrlScheme"] as? String,
let preferEphemeral = arguments["preferEphemeral"] as? Bool
{
I currently don't have access to a working XCode environment, so I'm afraid I can't create a PR for this.
Hello @LinusU, can you please find a working solution for the same? I've got a major dependency on the same.