谷歌如何通过多个域管理sso [google.com,youtube.com]

时间:2018-05-09 16:33:58

标签: javascript https single-sign-on session-cookies setcookie

当我们登录谷歌时。它为Google和youtube域设置了Cookie。 在网络中,我看到两个有趣的来电,

  1. https://mail.google.com/accounts/SetOSID?authuser
  2. https://accounts.youtube.com/accounts/SetSID
  3. 如何获得相同的结果?

    我必须通过google.com等网站为youtube.com等网站设置Cookie。

    我尝试制作XMLHttpRequest()。它没用。但是,如果我在单独的选项卡中打开我的第二个域,它会为第二个域设置cookie。

    My request header :
    Request URL: https://mysite.ngrok.io/SetSID?params=xyz
    Request Method: GET
    Status Code: 302 Found
    Remote Address: xx.xx.xxx.xxx:xxx
    Referrer Policy: no-referrer-when-downgrade
    
    
    My Response Header :
    Access-Control-Allow-Headers: X-Requested-With
    Access-Control-Allow-Origin: *
    Content-Length: 184
    Content-Type: text/plain; charset=utf-8
    Date: Wed, 09 May 2018 16:29:34 GMT
    Location: https://mysite.ngrok.io/SetSID/callback?params=xyz
    set-cookie: _cookie=sample; Path=/; HttpOnly
    Vary: Accept
    X-Powered-By: Express
    

    如果我们检查控制台,请求类型是二进制的。

    它是否以某种方式帮助他们实现目前的目标?

    enter image description here

    1. 此API已被点击 https://myaccount.google.com/accounts/SetOSID?authuser=1&continue=https%3A%2F%2Faccounts.youtube.com%2Faccounts%2FSetSID

    2. 接着是api     https://accounts.youtube.com/accounts/SetSID?ssdc=1&sidt=xxx&continue=https://mail.google.com/mail/u//?authuser

    3. 如果我没错,Google会在一瞬间加载https://accounts.youtube.com并设置Cookie。然后继续mail.google.com。 (参见续篇中的参数)

0 个答案:

没有答案