luis901101 / oauth_webauth

BSD 3-Clause "New" or "Revised" License
15 stars 17 forks source link

[BaseWebView] Default userAgent in the InAppWebView #6

Closed david-bauduin closed 1 year ago

david-bauduin commented 2 years ago

Hello !

At first thanks for this lovely plugin, using webview instead the Custom Chrome Tabs is perfect for the use i need.

i see in the base_web_view.dart :

/// This custom userAgent is mandatory due to security constraints of Google's OAuth2 policies (https://developers.googleblog.com/2021/06/upcoming-security-changes-to-googles-oauth-2.0-authorization-endpoint.html) userAgent: 'Mozilla/5.0',

you forced the userAgent to Mozilla/5.0 that working with a social connect like google but with facebook that force the desktop version.

Is it possible to change to a more complex userAgent like : userAgent: Platform.isIOS ? 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_1_2 like Mac OS X) AppleWebKit/605.1.15' + ' (KHTML, like Gecko) Version/13.0.1 Mobile/15E148 Safari/604.1' : 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) ' + 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Mobile Safari/537.36',

or passing the parameter from the OAuthWebScreen.start ?

Thanks in advance!

david-bauduin commented 2 years ago

Ok sorry, i guess the Mozilla/5.0 is there coz :

https://developers.facebook.com/blog/post/2021/06/28/deprecating-support-fb-login-authentication-android-embedded-browsers/

luis901101 commented 2 years ago

You're welcome @stddd, I'm glad this plugin is useful for you. Exactly, if you set a very specific Agent somehow Authorization Providers detects the request is being done from an embedded web view and get's declined. Anyway if you think it's good to have the possibility to set a custom userAgent let me know and I will add it as a param.

ENHardware commented 3 months ago

Hi! I've been using this plugin for my application and have a need for the UserAgent to be custom set. Is that something that can be done? I appreciate all the work that has been done on this, this change would be very helpful.

(Let me know if it's best if I create another issue instead of bumping this closed one)

luis901101 commented 3 months ago

Hi! I've been using this plugin for my application and have a need for the UserAgent to be custom set. Is that something that can be done? I appreciate all the work that has been done on this, this change would be very helpful.

(Let me know if it's best if I create another issue instead of bumping this closed one)

Done oauth_webauth: ^5.1.0