authentication - Web Google 身份验证 - 403 : disallowed_useragent exists? 的解决方法

标签 authentication webview google-oauth google-authentication

有很多关于这个问题的 StackOverflow 帖子,但没有一个提供网络应用程序通过谷歌网络身份验证在嵌入式浏览器(如 iOS 上的 Facebook/Facebook Messenger)中登录服务的解决方法;但我发现使用 Google 按钮登录 Pinterest 的网络似乎可以正常工作,所以我想知道是否有人知道他们是如何使其工作的。
Google disallowed logging into Google from webviews几年前,还有Auth0 also made a blog post about workarounds ,但这一切似乎都集中在 native 应用程序上,而不是提供 Google 作为登录选项的网络应用程序。
但是我公司的应用程序是一个网络应用程序,如果有人在 Facebook Messenger/Facebook 帖子上分享到我们网站的链接,即使用户没有弹出原生 Safari 浏览器,也可以使用 Google 登录.根据上述文档,这似乎是不可能的 - 但实际上我发现 Pinterest 的“使用 Google 登录”按钮确实有效!因此,似乎有一种方法可以让 Google 登录正常工作(不确定他们是否与 Google 达成了特殊协议(protocol),或者他们是否正在做我们/Auth0 也可以做的事情)。
复现步骤:

  • 在 iOS 中打开 Facebook Messenger(这也应该大致适用于 Facebook,但这说明了问题)
  • 给自己发送一 strip 有 URL https://community.auth0.com 的消息
  • 点击Auth0社区论坛链接
  • 点击登录
  • 点击 Google 登录
  • 看到您收到 403: disallowed_useragent 错误。

  • 并证明似乎确实有一种方法可以在野外完成:
  • 确保您的手机没有安装 Pinterest(否则您的手机将在 native 应用程序中打开它)。
  • 在 iOS 中打开 Facebook Messenger
  • 给自己发送一 strip 有 URL https://pinterest.com 的消息
  • 点击 Pinterest 链接
  • 点击“使用谷歌登录”
  • 不知何故,当 Pinterest 这样做时,它不会出错!

  • 任何人都知道这里发生了什么?
    此问题已 cross-posted to Auth0's support community forum ,因为我的团队通过 Auth0 实现了 Google Auth,但它似乎通常与 Auth0 相关。
    编辑:查看 Google OAuth 端点 URL 我的站点与 Pinterest 的更多详细信息:
    查看我的网站与 Pinterest 使用的 Google oauth URL,我看到了一些不同之处:
  • 我的去https://accounts.google.com/o/oauth2/auth , 他们的转至 https://accounts.google.com/o/oauth2/auth/identifier
  • 他们有一些我没有的额外查询参数:
  • ["openid.realm", ""]
    ["ss_domain", "https://www.pinterest.com"]
    ["fetch_basic_profile", "true"]
    ["gsiwebsdk", "2"]
    ["flowName", "GeneralOAuthFlow"]
    
  • 他们的 response_type 的值不同的 permission id_token , 我的是 code

  • 不知道会产生什么影响。
    编辑:this StackOverflow post from several months ago 中的相同问题但没有事件,和 this one from 4 years ago但他们声称没有办法——这似乎不是真的,因为 Pinterest 能够成功!同时 Spotify 和 StackOverflow 也因此错误而失败。可能是内幕交易...

    最佳答案

    403: disallowed user_agent是因为您的组织不允许使用该资源。 2017 年,谷歌实际上改变了帐户的身份验证方式。
    您可以从我的来源阅读更多信息:Google Login: Error 403: This user-agent is not permitted to make an OAuth authorization request to Google as it is classified as an embedded user-agent (disallowed_useragent)

    关于authentication - Web Google 身份验证 - 403 : disallowed_useragent exists? 的解决方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65353812/

    相关文章:

    java - 检测键盘何时在 Web View 中处于 Activity 状态

    node.js - 使用 OAuth 时的 Google 日历 "The request is missing a valid API key"

    google-oauth - 为什么我们需要clientID和clientSecret

    amazon-web-services - 登录成功后 MediaWiki 不会重定向到页面

    authentication - 支持基于客户端证书的身份验证的 Jabber 客户端

    android - android中方向改变的媒体查询

    ios - 使用 webView ios 显示下载的 PDF 文件

    ios - iOS 和 "invalid_grant"上的 Google 云端硬盘

    android - 从应用程序中清除所有 Smart Lock 密码凭据

    asp.net-core - ASP.NET Core 3.1 : User. Identity.Name 在 API Controller 中为空,但声明名称存在