1

我正在使用omniauth-google-oauth2 gem 通过谷歌帐户登录。最近我看到这篇文章https://developers.googleblog.com/2020/08/guidance-for-our-effort-to-block-less-secure-browser-and-apps.html。即使它不会影响到我担心单元测试的普通用户。我想使用无头浏览器。所以我想通过注入这篇文章(Google-Accounts-Check-OAuth-Login:true)中描述的标头来测试它。在 omiauth 文档中找不到任何 api 方法。

 OmniAuth.config.mock_auth[:google] = OmniAuth::AuthHash.new(
      provider: "google",
      uid: "123545",
      info: {
        email: EMAIL,
        first_name: FIRST_NAME,
        last_name: LAST_NAME,
      }
    )

    visit new_user_registration_path
    click_link "Sign in with Google"
4

0 回答 0