Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error after authorization- Failed to handle method call #5

Closed
mprabhu33 opened this issue Jan 30, 2020 · 6 comments
Closed

Comments

@mprabhu33
Copy link

mprabhu33 commented Jan 30, 2020

Trying to authorization using Microsoft office 365 account,
Error:
E/MethodChannel#oauth2_custom_uri_scheme( 481): Failed to handle method call
E/MethodChannel#oauth2_custom_uri_scheme( 481): java.lang.UnsupportedOperationException: The new embedding does not support the old FlutterView.
E/MethodChannel#oauth2_custom_uri_scheme( 481): at io.flutter.embedding.engine.plugins.shim.ShimRegistrar.view(ShimRegistrar.java:82)
E/MethodChannel#oauth2_custom_uri_scheme( 481): at jp.espresso3389.oauth2_custom_uri_scheme.Oauth2CustomUriSchemePlugin.onMethodCall(Oauth2CustomUriSchemePlugin.kt:53)
E/MethodChannel#oauth2_custom_uri_scheme( 481): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:231)
E/MethodChannel#oauth2_custom_uri_scheme( 481): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:93)
E/MethodChannel#oauth2_custom_uri_scheme( 481): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:642)
E/MethodChannel#oauth2_custom_uri_scheme( 481): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#oauth2_custom_uri_scheme( 481): at android.os.MessageQueue.next(MessageQueue.java:325)
E/MethodChannel#oauth2_custom_uri_scheme( 481): at android.os.Looper.loop(Looper.java:142)
E/MethodChannel#oauth2_custom_uri_scheme( 481): at android.app.ActivityThread.main(ActivityThread.java:6626)
E/MethodChannel#oauth2_custom_uri_scheme( 481): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#oauth2_custom_uri_scheme( 481): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
E/MethodChannel#oauth2_custom_uri_scheme( 481): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:811)
I/flutter ( 481): PlatformException(error, The new embedding does not support the old FlutterView., null)

Configuration:
final oauth2Config = OAuth2Config(
uniqueId: 'example.com#1',
authorizationEndpoint: Uri.parse("https://login.microsoftonline.com/common/oauth2/v2.0/authorize"),
tokenEndpoint: Uri.parse("https://login.microsoftonline.com/common/oauth2/v2.0/token"),

// NOTE: For Android, we also have corresponding intent-filter entry on example/android/app/src/main/AndroidManifest.xml
redirectUri: Uri.parse('com.example.redirect43763246328://callback'),
scope: "user.read",
clientId: "xxxxxxxx",
clientSecret: "xxxxxx"

);

Android Manifest.xml:
image

Microsoft Office 365 Redirect URI configuration:
image

Not able to get token after authorization.

Please let me know, how to resolve the issue and get token.

@mprabhu33 mprabhu33 changed the title Getting error after authentication - Failed to handle method call Getting error after authorization- Failed to handle method call Jan 30, 2020
espresso3389 added a commit that referenced this issue Jan 30, 2020
…mbedding does not support the old FlutterView. at io.flutter.embedding.engine.plugins.shim.ShimRegistrar.view(ShimRegistrar.java:82)
@espresso3389
Copy link
Owner

Could you please try the git version by replacing the dependency to pub.dev's oauth2_custom_uri_scheme with the following one:

  oauth2_custom_uri_scheme:
    git:
      https://github.com/espresso3389/oauth2_custom_uri_scheme

If it works for you, I'll publish a new package as soon as possible.

@espresso3389
Copy link
Owner

Sorry, the previous commit does not fix the issue and 7d4d869 (0.3.8) finally fixes the issue.

@mprabhu33
Copy link
Author

Thanks @espresso3389
But app getting crashed when include the oauth2_custom_uri_scheme in pubspec.yaml.
oauth2_custom_uri_scheme: ^0.3.9

Tried all versions 0.3.6, 0.3.8 and 0.3.9
Also direct from git
oauth2_custom_uri_scheme:
git:
https://github.com/espresso3389/oauth2_custom_uri_scheme

Application getting crashed, if exclude/comment oauth2_custom_uri_scheme application is working fine.

Attached sample project,
test_oauth.zip

Could you please check the issue?

@espresso3389
Copy link
Owner

Woops,

We're hitting the issue just now...
pichillilorenzo/flutter_inappwebview#220

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.oauth_test, PID: 15697
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.oauth_test/com.example.oauth_test.MainActivity}: java.lang.NullPointerException: Attempt to invoke interface method 'io.flutter.plugin.common.BinaryMessenger io.flutter.plugin.common.PluginRegistry$Registrar.messenger()' on a null object reference
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3430)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3614)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:86)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2199)
        at android.os.Handler.dispatchMessage(Handler.java:112)
        at android.os.Looper.loop(Looper.java:216)
        at android.app.ActivityThread.main(ActivityThread.java:7625)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
     Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'io.flutter.plugin.common.BinaryMessenger io.flutter.plugin.common.PluginRegistry$Registrar.messenger()' on a null object reference
        at com.pichillilorenzo.flutter_inappwebview.InAppBrowser.<init>(InAppBrowser.java:66)
        at com.pichillilorenzo.flutter_inappwebview.InAppWebViewFlutterPlugin.onAttachedToEngine(InAppWebViewFlutterPlugin.java:40)
        at io.flutter.embedding.engine.FlutterEnginePluginRegistry.add(FlutterEnginePluginRegistry.java:130)
        at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:17)
        at com.example.oauth_test.MainActivity.configureFlutterEngine(MainActivity.kt:10)
        at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onAttach(FlutterActivityAndFragmentDelegate.java:186)
        at io.flutter.embedding.android.FlutterActivity.onCreate(FlutterActivity.java:421)
        at android.app.Activity.performCreate(Activity.java:7458)
        at android.app.Activity.performCreate(Activity.java:7448)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1286)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3409)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3614) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:86) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2199) 
        at android.os.Handler.dispatchMessage(Handler.java:112) 
        at android.os.Looper.loop(Looper.java:216) 
        at android.app.ActivityThread.main(ActivityThread.java:7625) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987) 

@espresso3389
Copy link
Owner

There's a release blocker and I just released a release, 0.3.10 which is based on 0.3.6 (the code is not changed) so it's anyway not fixing any things but it just work on certain environments.

So if you want to check the latest version, please use the latest github commit. I think the following commit will work:

  oauth2_custom_uri_scheme:
    git:
      url: https://github.com/espresso3389/oauth2_custom_uri_scheme
      ref: a94d9e76001fb09c4761eda47fd47ecdca9f08e4

@espresso3389
Copy link
Owner

0.4.3 introduces flutter_inappwebview 4.0.0 and the issue is fixed.

espresso3389 added a commit that referenced this issue Jul 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants