7

開始〜2周前,一些客戶開始遇到阻止他們使用Google服務進行身份驗證的問題。到目前爲止,我遇到的所有實例都顯示在非gmail域上。問題似乎是(請參閱下面的差異部分),gapi.auth.authorize的https://accounts.google.com/o/oauth2/auth請求正在爲這些特定客戶端返回帶有'X-Frame-Options:SAMEORIGIN'標頭的響應。我一直無法在本地重現此問題,但卻收到了失敗請求的HAR。Google OAuth gapi.auth.authorize X-Frame-Options:SAMEORIGIN

對於包括其他託管域(非@ gmail帳戶)在內的各種其他客戶端,此相同的身份驗證方法可以很好地工作。

有關可能會導致此請求失敗的任何想法?需要進一步調查的事項或其他信息?

在開發者控制檯https://www.moo.do是一個有效的Javascript來源。

最終顯示在用戶控制檯中的錯誤: 由X-Frame-Options拒絕的負載:https://accounts.google.com/o/oauth2/auth?不允許交叉起源框架。

相似

  • 這些請求的兩個授權時使用即時=真。當使用immediate = false(導致請求通過賬戶選擇器彈出窗口)失敗賬戶成功地爲請求提供服務時)。

差異

  • 在響應於所述故障帳戶有一個X框-選項首部。
  • 在對失敗帳戶的響應中,response.content.size字段爲0.此外,response._transferSize爲0,並且存在response._error字段(其爲空)。
  • 在失敗帳戶的響應中,作用域參數被編碼爲已被棄用的'[scope] + [scope] + [scope]'「。 [編輯:收到另一個HAR使用適當的非棄用的空間分隔範圍仍然失敗]

下面是一個成功的和失敗的請求。我爲什麼失敗的請求正在返回額外的頭文件不知所措。部分信息已被刪除([刪除])或編輯(XXXX/YYYY)。

成功的請求

{ 
    "startedDateTime": "2016-03-03T15:52:27.625Z", 
    "time": 84.7660000436008, 
    "request": { 
    "method": "GET", 
    "url": "https://accounts.google.com/o/oauth2/auth?client_id=597847337936.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.install%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.appdata%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcalendar.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcalendar%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcontacts.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgmail.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.metadata.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&immediate=true&login_hint=YYYYY%40YYYY.com&authuser=-1&include_granted_scopes=true&proxy=oauth2relay593501023&redirect_uri=postmessage&origin=https%3A%2F%2Fwww.moo.do&response_type=token&state=867674703%7C0.1520984533&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.en.d1w1l2mcNcs.O%2Fm%3D__features__%2Fam%3DAQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCMuer-UxvQzEv7JYzkFSQh2Kou7xA", 
    "httpVersion": "unknown", 
    "headers": [ 
     { 
     "name": "pragma", 
     "value": "no-cache" 
     }, 
     { 
     "name": "accept-encoding", 
     "value": "gzip, deflate, sdch" 
     }, 
     { 
     "name": "accept-language", 
     "value": "en-US,en;q=0.8" 
     }, 
     { 
     "name": "upgrade-insecure-requests", 
     "value": "1" 
     }, 
     { 
     "name": "user-agent", 
     "value": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.97 Safari/537.36" 
     }, 
     { 
     "name": "accept", 
     "value": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" 
     }, 
     { 
     "name": "cache-control", 
     "value": "no-cache" 
     }, 
     { 
     "name": ":authority", 
     "value": "accounts.google.com" 
     }, 
     { 
     "name": "cookie", 
     "value": [REMOVED] 
     }, 
     { 
     "name": ":scheme", 
     "value": "https" 
     }, 
     { 
     "name": "x-chrome-connected", 
     "value": "id=108229145437218213687,mode=0,enable_account_consistency=false" 
     }, 
     { 
     "name": "referer", 
     "value": "https://www.moo.do/app/" 
     }, 
     { 
     "name": "x-client-data", 
     "value": "CKO2yQEIwbbJAQj9lcoB" 
     }, 
     { 
     "name": ":method", 
     "value": "GET" 
     } 
    ], 
    "queryString": [ 
     { 
     "name": "client_id", 
     "value": "597847337936.apps.googleusercontent.com" 
     }, 
     { 
     "name": "scope", 
     "value": "https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.install%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.appdata%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcalendar.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcalendar%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcontacts.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgmail.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.metadata.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive" 
     }, 
     { 
     "name": "immediate", 
     "value": "true" 
     }, 
     { 
     "name": "login_hint", 
     "value": "YYYYY%40YYYY.com" 
     }, 
     { 
     "name": "authuser", 
     "value": "-1" 
     }, 
     { 
     "name": "include_granted_scopes", 
     "value": "true" 
     }, 
     { 
     "name": "proxy", 
     "value": "oauth2relay593501023" 
     }, 
     { 
     "name": "redirect_uri", 
     "value": "postmessage" 
     }, 
     { 
     "name": "origin", 
     "value": "https%3A%2F%2Fwww.moo.do" 
     }, 
     { 
     "name": "response_type", 
     "value": "token" 
     }, 
     { 
     "name": "state", 
     "value": "867674703%7C0.1520984533" 
     }, 
     { 
     "name": "jsh", 
     "value": "m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.en.d1w1l2mcMcs.O%2Fm%3D__features__%2Fam%3DAQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCMuer-UxvQzEv7JYzkFSQh2Kou7xA" 
     } 
    ], 
    "cookies": [ 
     { 
     "name": "LSOLH", 
     "value": [REMOVED], 
     "expires": null, 
     "httpOnly": false, 
     "secure": false 
     }, 
     { 
     "name": "SMSV", 
     "value": [REMOVED], 
     "expires": null, 
     "httpOnly": false, 
     "secure": false 
     }, 
     { 
     "name": "RMME", 
     "value": "false", 
     "expires": null, 
     "httpOnly": false, 
     "secure": false 
     }, 
     { 
     "name": "ACCOUNT_CHOOSER", 
     "value": [REMOVED], 
     "expires": null, 
     "httpOnly": false, 
     "secure": false 
     }, 
     { 
     "name": "GALX", 
     "value": [REMOVED], 
     "expires": null, 
     "httpOnly": false, 
     "secure": false 
     }, 
     { 
     "name": "GoogleAccountsLocale_session", 
     "value": "en", 
     "expires": null, 
     "httpOnly": false, 
     "secure": false 
     }, 
     { 
     "name": "expor", 
     "value": "3100077", 
     "expires": null, 
     "httpOnly": false, 
     "secure": false 
     }, 
     { 
     "name": "GMAIL_RTT", 
     "value": "151", 
     "expires": null, 
     "httpOnly": false, 
     "secure": false 
     }, 
     { 
     "name": "S", 
     "value": [REMOVED], 
     "expires": null, 
     "httpOnly": false, 
     "secure": false 
     }, 
     { 
     "name": "SID", 
     "value": [REMOVED], 
     "expires": null, 
     "httpOnly": false, 
     "secure": false 
     }, 
     { 
     "name": "LSID", 
     "value": [REMOVED], 
     "expires": null, 
     "httpOnly": false, 
     "secure": false 
     }, 
     { 
     "name": "HSID", 
     "value": [REMOVED], 
     "expires": null, 
     "httpOnly": false, 
     "secure": false 
     }, 
     { 
     "name": "SSID", 
     "value": [REMOVED], 
     "expires": null, 
     "httpOnly": false, 
     "secure": false 
     }, 
     { 
     "name": "APISID", 
     "value": [REMOVED], 
     "expires": null, 
     "httpOnly": false, 
     "secure": false 
     }, 
     { 
     "name": "SAPISID", 
     "value": [REMOVED], 
     "expires": null, 
     "httpOnly": false, 
     "secure": false 
     }, 
     { 
     "name": "GAPS", 
     "value": [REMOVED], 
     "expires": null, 
     "httpOnly": false, 
     "secure": false 
     }, 
     { 
     "name": "LSOLH", 
     "value": [REMOVED], 
     "expires": null, 
     "httpOnly": false, 
     "secure": false 
     }, 
     { 
     "name": "OGPC", 
     "value": [REMOVED], 
     "expires": null, 
     "httpOnly": false, 
     "secure": false 
     }, 
     { 
     "name": "NID", 
     "value": [REMOVED], 
     "expires": null, 
     "httpOnly": false, 
     "secure": false 
     } 
    ], 
    "headersSize": -1, 
    "bodySize": 0 
    }, 
    "response": { 
    "status": 200, 
    "statusText": "OK", 
    "httpVersion": "unknown", 
    "headers": [ 
     { 
     "name": "pragma", 
     "value": "no-cache" 
     }, 
     { 
     "name": "date", 
     "value": "Thu, 03 Mar 2016 15:52:27 GMT" 
     }, 
     { 
     "name": "content-encoding", 
     "value": "gzip" 
     }, 
     { 
     "name": "x-content-type-options", 
     "value": "nosniff" 
     }, 
     { 
     "name": "server", 
     "value": "GSE" 
     }, 
     { 
     "name": "content-language", 
     "value": "en" 
     }, 
     { 
     "name": "status", 
     "value": "200" 
     }, 
     { 
     "name": "cache-control", 
     "value": "no-cache, no-store, max-age=0, must-revalidate" 
     }, 
     { 
     "name": "content-type", 
     "value": "text/html; charset=UTF-8" 
     }, 
     { 
     "name": "alt-svc", 
     "value": "quic=\":443\"; ma=2592000; v=\"30,29,28,27,26,25\"" 
     }, 
     { 
     "name": "alternate-protocol", 
     "value": "443:quic,p=1" 
     }, 
     { 
     "name": "x-xss-protection", 
     "value": "1; mode=block" 
     }, 
     { 
     "name": "expires", 
     "value": "Fri, 01 Jan 1990 00:00:00 GMT" 
     } 
    ], 
    "cookies": [], 
    "content": { 
     "size": 2096, 
     "mimeType": "text/html" 
    }, 
    "redirectURL": "", 
    "headersSize": -1, 
    "bodySize": -1, 
    "_transferSize": 1051 
    }, 
    "cache": {}, 
    "timings": { 
    "blocked": 1.07300002127886, 
    "dns": -1, 
    "connect": -1, 
    "send": 0.39199995808303, 
    "wait": 81.3200001139194, 
    "receive": 1.9809999503195002, 
    "ssl": -1 
    }, 
    "connection": "2025013", 
    "pageref": "page_1" 
} 

失敗請求

{ 
    "startedDateTime": "2016-03-03T10:12:35.752Z", 
    "time": 442.6579999853857, 
    "request": { 
    "method": "GET", 
    "url": "https://accounts.google.com/o/oauth2/auth?client_id=597847337936.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.install+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.appdata+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcontacts.readonly+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.metadata.readonly+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcalendar.readonly+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcalendar+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgmail.readonly&immediate=true&login_hint=XXXXX%40XXXX.com&authuser=-1&include_granted_scopes=true&proxy=oauth2relay235542267&redirect_uri=postmessage&origin=https%3A%2F%2Fwww.moo.do&response_type=token&state=638324187%7C0.1211244794&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.de.7pJmZpTVQp8.O%2Fm%3D__features__%2Fam%3DAQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCOmU_zLoubGrUI-_ZI9ZhB7rGP1Sw", 
    "httpVersion": "unknown", 
    "headers": [ 
     { 
     "name": "Accept", 
     "value": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" 
     }, 
     { 
     "name": "Referer", 
     "value": "https://www.moo.do/app/" 
     }, 
     { 
     "name": "Upgrade-Insecure-Requests", 
     "value": "1" 
     }, 
     { 
     "name": "User-Agent", 
     "value": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36" 
     } 
    ], 
    "queryString": [ 
     { 
     "name": "client_id", 
     "value": "597847337936.apps.googleusercontent.com" 
     }, 
     { 
     "name": "scope", 
     "value": "https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.install+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.appdata+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcontacts.readonly+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.metadata.readonly+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcalendar.readonly+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcalendar+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgmail.readonly" 
     }, 
     { 
     "name": "immediate", 
     "value": "true" 
     }, 
     { 
     "name": "login_hint", 
     "value": "XXXXX%40XXXX.com" 
     }, 
     { 
     "name": "authuser", 
     "value": "-1" 
     }, 
     { 
     "name": "include_granted_scopes", 
     "value": "true" 
     }, 
     { 
     "name": "proxy", 
     "value": "oauth2relay235542267" 
     }, 
     { 
     "name": "redirect_uri", 
     "value": "postmessage" 
     }, 
     { 
     "name": "origin", 
     "value": "https%3A%2F%2Fwww.moo.do" 
     }, 
     { 
     "name": "response_type", 
     "value": "token" 
     }, 
     { 
     "name": "state", 
     "value": "638324187%7C0.1211244794" 
     }, 
     { 
     "name": "jsh", 
     "value": "m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.de.7pJmZpTVQp8.O%2Fm%3D__features__%2Fam%3DAQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCOmU_zLoubGrUI-_ZI9ZhB7rGP1Sw" 
     } 
    ], 
    "cookies": [], 
    "headersSize": -1, 
    "bodySize": 0 
    }, 
    "response": { 
    "status": 200, 
    "statusText": "OK", 
    "httpVersion": "unknown", 
    "headers": [ 
     { 
     "name": "pragma", 
     "value": "no-cache" 
     }, 
     { 
     "name": "date", 
     "value": "Thu, 03 Mar 2016 10:12:35 GMT" 
     }, 
     { 
     "name": "content-encoding", 
     "value": "gzip" 
     }, 
     { 
     "name": "x-content-type-options", 
     "value": "nosniff" 
     }, 
     { 
     "name": "server", 
     "value": "GSE" 
     }, 
     { 
     "name": "x-frame-options", 
     "value": "SAMEORIGIN" 
     }, 
     { 
     "name": "content-language", 
     "value": "de" 
     }, 
     { 
     "name": "status", 
     "value": "200" 
     }, 
     { 
     "name": "cache-control", 
     "value": "no-cache, no-store, max-age=0, must-revalidate" 
     }, 
     { 
     "name": "content-type", 
     "value": "text/html; charset=UTF-8" 
     }, 
     { 
     "name": "alt-svc", 
     "value": "quic=\":443\"; ma=2592000; v=\"30,29,28,27,26,25\"" 
     }, 
     { 
     "name": "alternate-protocol", 
     "value": "443:quic,p=1" 
     }, 
     { 
     "name": "x-xss-protection", 
     "value": "1; mode=block" 
     }, 
     { 
     "name": "expires", 
     "value": "Fri, 01 Jan 1990 00:00:00 GMT" 
     } 
    ], 
    "cookies": [], 
    "content": { 
     "size": 0, 
     "mimeType": "text/html" 
    }, 
    "redirectURL": "", 
    "headersSize": -1, 
    "bodySize": -1, 
    "_transferSize": 0, 
    "_error": "" 
    }, 
    "cache": {}, 
    "timings": { 
    "blocked": 0.944999977946281, 
    "dns": -1, 
    "connect": -1, 
    "send": 0.3190000134054589, 
    "wait": 151.53400000417625, 
    "receive": 289.85999998985767, 
    "ssl": -1 
    }, 
    "pageref": "page_1" 
} 

回答

2

大。頭到託管域帳戶(谷歌應用)如果應用程序,使得對於超過7個OAuth範圍的請求:

問題/原因

的谷歌授權服務器的「SAMEORIGIN X框-選項」連接。小於7(這與範圍無關),並且同一帳戶上的相同請求沒有在返回調用中指定的X-Frame-Options標頭。

還有其他移動部件需要這些repro發生(必須提供來自GAPI JS客戶端的jsh參數)以及返回X-Frame-Options標頭的其他場景。但是,此時repro文件顯示Google授權服務器似乎存在問題。

抱怨:)

由於X框-選項首部的性質,客戶端錯誤檢測將不知道的請求已被阻止,這使得此特定錯誤甚至更成問題的。此外,授權回調將永遠不會收到任何類型的錯誤通知,讓請求應用程序處於等待任何類型通知的狀態。

問題示範

Demos

有兩個攝製的文件有:

auth_repro.html - 這完全迴避了GAPI JS客戶端和展示的問題。它確實使用了客戶端附加到授權請求的特定參數(jsh)來解決問題。

auth_repro_gapi.html - 這使用GAPI JS客戶端來重現問題。

解決方案

不要偷懶一下微調/管理範圍您請求或授權的請求將開始默默地失敗。

如果這種行爲不是一回事,這也會很好。最好的猜測是這是一個安全措施出錯了?