j0j00 / flutter_user_agent

Retrieve Android/iOS device user agents in Flutter.
https://pub.dev/packages/flutter_user_agent
BSD 2-Clause "Simplified" License
25 stars 55 forks source link

Error 403: disallowed_useragent on Google Auth Page in Android App #11

Closed ycv005 closed 4 years ago

ycv005 commented 4 years ago

For example- if I am getting a user agent- 'Mozilla/5.0 (Linux; Android 10; RMX1851 Build/QKQ1.190918.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/81.0.4044.138 Mobile Safari/537.36'; Then using it in webview plugin, for page of Google Oauth(it must required some user agent), google is giving is error Error 403: disallowed_useragent .

Temporary Solution I found is that- when I replace ; wv with ` (blank string) in the user agent, it is working (this idea came by seeing- other user agent example on web). Resultant user_agent-Mozilla/5.0 (Linux; Android 10; RMX1851 Build/QKQ1.190918.001) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/81.0.4044.138 Mobile Safari/537.36'`

sam-parks commented 4 years ago

I'm having this same issue with this user agent on iOS:

Mozilla/5.0 (iPhone; CPU iPhone OS 13_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148

j0j00 commented 4 years ago

It sounds like this is an issue with Google specifically not allowing webview agents.

Glad you found a solution for it.

I would probably recommend reading up on the Google documentation and see if they recommend using an app specific user-agent instead of a dynamic device one as it might be needed for usage statistics purposes.