espresso3389 / oauth2_custom_uri_scheme

A Flutter plugin that implements Authorizaion code grant with browser redirect support.
https://pub.dev/packages/oauth2_custom_uri_scheme/
MIT License
2 stars 0 forks source link

token not receiving #4

Closed nullhandler closed 4 years ago

nullhandler commented 4 years ago

The token is redirected to the redirect URL. Still, the plugin doesnt retrieve the token and close the custom tab. The redirect URL I have used is http://in.selvasoft.lite123 Also this warning while compiling the app

warning: [deprecation] getFlutterEngine() in FlutterPluginBinding has been deprecated
setupChannel(binding.getFlutterEngine().getDartExecutor(), binding.getApplicationContext());
espresso3389 commented 4 years ago

Android or iOS? For Android, you should setup your redirect URL on AndroidManifest.xml as explained here.

nullhandler commented 4 years ago

for android. Yeah I followed those steps. Still its not catching.

nullhandler commented 4 years ago

the chrome custom tabs is closing. but the token object is null. Try running your example. See the following in the logs

I/flutter (  427): Custom Chrome Tab seems to be closed.
I/flutter (  427): PlatformException(error, The new embedding does not support the old FlutterView., null)
espresso3389 commented 4 years ago

Could you please show me your AndroidManifest.xml?

nullhandler commented 4 years ago

here you go. I am just running the code from your example folder. Are you in telegram? Can you try running your example code?

nullhandler commented 4 years ago

@espresso3389

espresso3389 commented 4 years ago

You could not use http://in.selvasoft.lite123 as redirect URL unless you properly configure deep-link; futhermore, http is not good for our purpose anyway.

To make redirect URL work, we should use URL like myapp://foobar or such.

In your AndroidManifest.xml, you have the following redirect URL config:

<data android:scheme="com.example.redirect43763246328" android:host="callback" />

And the redirect URL must be com.example.redirect43763246328:callback.

nullhandler commented 4 years ago

@espresso3389 I am just running your example. Where did you found http://in.selvasoft.lite123? Try running your example folder.

espresso3389 commented 4 years ago

For what service do you run the sample? Your redirect URI must be registered on the service website.

nullhandler commented 4 years ago

@espresso3389 I registered at the reddit. Is there any better way to contact you?

mprabhu33 commented 4 years ago

Am getting same error. @selvasoft Are you able to resolve the issue?

nullhandler commented 4 years ago

@mprabhu33 No its still the same. So, I implemented on my own.

espresso3389 commented 4 years ago

the chrome custom tabs is closing. but the token object is null. Try running your example. See the following in the logs

I/flutter (  427): Custom Chrome Tab seems to be closed.
I/flutter (  427): PlatformException(error, The new embedding does not support the old FlutterView., null)

Wow, I realized the issue is identical to #5 just now. And, at least, on my environmens, it worked without any issues. On #5, I just modified the code without knowing the actual cause of the issue but just change the way to obtain Context according to the ShimRegistrar.java code

So anyway, the change was already commited. Please reference #5 for that.

espresso3389 commented 4 years ago

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

nullhandler commented 4 years ago

thanks for the library @espresso3389