flutter_web_auth icon indicating copy to clipboard operation
flutter_web_auth copied to clipboard

MissingPluginException (MissingPluginException(No implementation found for method authenticate on channel flutter_web_auth))

Open bgomez-signa opened this issue 2 years ago • 5 comments

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!

bgomez-signa avatar May 17 '22 12:05 bgomez-signa

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...

LinusU avatar May 29 '22 10:05 LinusU

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 avatar Jan 23 '23 10:01 koenmuilwijk

@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 avatar Feb 01 '23 04:02 LinusU

@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.

koenmuilwijk avatar Feb 01 '23 10:02 koenmuilwijk

Hello @LinusU, can you please find a working solution for the same? I've got a major dependency on the same.

meet7-sagar23 avatar Apr 26 '23 11:04 meet7-sagar23