Google使用网络视图登录应用

时间:2018-12-09 10:51:48

标签: android web-applications android-webview google-oauth

我正在尝试在网络视图中的android APK中打开我的移动响应网站。它已通过Google登录,在桌面或移动Bowser上都能很好地运行。但无法在android网络视图中使用。 Google错误消息说:“ OAuth在Web视图中不起作用”。

screenshot of the error

那么如何在基于Web视图的应用程序中实现Google登录?请引导我。

2 个答案:

答案 0 :(得分:0)

您不能。请参阅错误消息。只有浏览器可以成为用户的Google身份验证过程的一部分。这是Google帐户部署的安全策略。

您将需要创建标准的OAuth 2.0流。这是一个入门指南。

Using OAuth 2.0 to Access Google APIs

答案 1 :(得分:0)

您必须使用以下代码为Android WebView设置用户代理。您可以使用任何想要的字符串。

webview.getSettings().setUserAgentString("yor-user-agent-string");

http://developer.android.com/reference/android/webkit/WebSettings.html

相关问题