Webview / Google Login Disallow User Agent

edited March 2023 in Social Login

Hello,

I have created a webview app for a website. When I try to login to google via this webview app, I get a message that the user agent is not allowed (403). You know this message and I also know that Google issues this message if you want to register via Webview.

That's why I changed the user agent in the app and removed the "; wv". Unfortunately, this error message 403 still comes up. This is no longer due to the user agent, but because a new instance is opened by the social login and the user agent I set does not work in the new instance. I have set the user agent correctly in the app. I have now found that when I use the login page with popup:

_oneall.push(['social_login', 'set_popup_usage', 'always']);

The error message from Google no longer comes. I can do log in but after entering the password and ok, the gray wheel spins all the time and when I refresh again the page appears:

This is an intermediate page that is not supposed to be opened directly.

If I understand all of this correctly, the callback does not work within the webview when you work with popup. Is there a way to set another callback or solve this problem?

Thank you very much for your help.

Kind regards

Answers

  • Angela_LaupeAngela_LaupeMember
    edited March 2023

    I found here a topic with a similiar question:

    https://stackoverflow.com/questions/75564081/android-webview-custom-user-agent-is-getting-reset-when-a-new-tab-is-opened-in-t

    However, when any page opens a link in new tab via target="_blank" or JS handling, the user agent gets reset to the default one. setJavaScriptCanOpenWindowsAutomatically and setSupportMultipleWindows are set as false. How to prevent the user agent string from getting reset to default in such cases?

    The reason is propably:

    https://developer.chrome.com/docs/multidevice/webview/#how-do-i-set-the-user-agent-of-the-webview

    You can set the user-agent by using the Java setUserAgentString method. This method only changes the user-agent string for requests sent by the WebView itself.

    You can't set the user-agent string used for XMLHttpRequests made from JavaScript. Those requests always use the default user-agent string.

    If this is true, then it would be nice if there is a solution to close the popup and redirect to the webview app, same as it happends if you do the login with a desktop browser via popup.

    Thank you

  • Unlike paintball, which can leave stains and require significant cleanup AKM 47, Orbeez are easy to clean up. They disintegrate into a gel-like substance when broken, which can be easily wiped away or left to degrade naturally.

Welcome!

Please sign in to your OneAll account to ask a new question or to contribute to the discussions.

Please click on the link below to connect to the forum with your OneAll account.