twitter-dart / twitter-oauth2-pkce

This library provides the optimized and easiest way to authenticate with Twitter's OAuth 2.0 PKCE in your Flutter app 🐦
https://pub.dev/packages/twitter_oauth2_pkce
BSD 3-Clause "New" or "Revised" License
14 stars 17 forks source link

Login falied in case user has Twitter App #34

Open hm86z opened 2 years ago

hm86z commented 2 years ago

Hello.. If user has a Twitter application on the mobile, it will be moved to it and then the login process is not completed successfully Especially if the Twitter app is closed, open it and then exit immediately is there any way to prevent web url to go to twitter app?

myConsciousness commented 2 years ago

Hi @hm86z , thanks for your feedback!

Unfortunately I can't check anything now because my Twitter account was frozen accidentally. So I even can't use my development tokens.

I guess it's due to your callback url, or maybe the bug from flutter_web_auth. Can you give more details?

Thank you.

hm86z commented 2 years ago

Thanks for the response, yes after checking it out, I found out that the bug is from flutter_web_auth, how can I find a replacement for it?

myConsciousness commented 1 year ago

Hi @hm86z ,

As of now, there is no alternative package available, I also don't know of any package that solves this.

I think it would be ideal if the flutter_web_auth development team could solve this, but this issue remained for some years...

guiguito commented 1 year ago

I face the same issue. Crash when the twitter app is installed. The twitter apps open and closes right away and we get a stack trace.

E/flutter ( 2483): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:653:7) E/flutter ( 2483): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:296:18) E/flutter ( 2483): E/flutter ( 2483): #2 FlutterWebAuth2MethodChannel.authenticate (package:flutter_web_auth_2_platform_interface/method_channel/method_channel_flutter_web_auth_2.dart:15:7) E/flutter ( 2483): E/flutter ( 2483): #3 IoWebAuth.authenticate (package:twitter_oauth2_pkce/src/auth/io_web_auth.dart:20:7)

myConsciousness commented 1 year ago

Hi @guiguito ,

I happened to find the following topic on the Twitter Forum.

https://twittercommunity.com/t/web-oauth-2-0-is-broken-on-android-if-twitter-app-is-installed/169698

Maybe is it related to your issue?

adakoda commented 1 year ago

Maybe is it related to your issue?

Yes, that is what the topic is about. The specific content of the message is the following link.

https://twittercommunity.com/t/web-oauth-2-0-is-broken-on-android-if-twitter-app-is-installed/169698/11

  1. If the user has the Twitter app installed and is currently closed. Clicking on the Login with Twitter will try to open the Twitter app, show a splash screen, and will close. ( Not sure we can do anything for a workaround )

The problem is reproduced under these conditions.

  1. If the user has the Twitter app installed and currently opened in the background. It will open in a webview inside the app. If it’s android, it might work since the chrome session is shared. But in the case of ios, it’s still broken. Post authorization it gets struck inside the webview.

No problems occur under these conditions.

TSurkis commented 1 year ago

@adakoda @myConsciousness This is only for Android.

On iOS it weirdly enough opens a browser, but after you authorize it opens the app and you get stuck there. But the 2nd time you click authorize it opens the browser with an authorize button because you previously logged in. Then clicking authorize redirects you back to the app.

TSurkis commented 1 year ago

For anybody reading this while this issue is still open this is what you can do (iOS & Android):

Identify whether a user has a Twitter app or not (there are libraries out there). You can use appcheck.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 30 days with no activity.

junixapp commented 1 year ago

same issue with latest version :

twitter_oauth2_pkce: ^1.0.2