2017-02-09 82 views
1

我查看了Google的OpenId Connect發現文檔here。它清楚地表明瞭支持的說法是:爲什麼Google的OpenId Connect API不發回所有索賠?

"claims_supported": [ 
    "aud", 
    "email", 
    "email_verified", 
    "exp", 
    "family_name", 
    "given_name", 
    "iat", 
    "iss", 
    "locale", 
    "name", 
    "picture", 
    "sub" 
] 

,支持的範圍是

"scopes_supported": [ 
    "openid", 
    "email", 
    "profile" 
] 

我希望,當我發送一個GET請求,OpenId Connect UserInfo end point(這是https://www.googleapis.com/oauth2/v3/userinfo),我會得到返回所有支持的索賠(假設當我通過身份驗證時,我請求了所有支持的範圍......我發送初始請求時所做的操作如下所示)

https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=my-client-id&redirect_uri=http://myapp.com&scope=openid profile email&state=someLongStateIdentifier 

下面是我從用戶信息終點請求的響應得到了索賠:

{ 
    "sub": "...", 
    "name": "...", 
    "given_name": "...", 
    "family_name": "...", 
    "picture": "...", 
    "email": "...", 
    "email_verified": true, 
    "locale": "..." 
} 

注意他們是如何支持的所有債權的一個子集......誰能告訴我,爲什麼我沒有得到所有我的迴應中支持的聲明?

+0

如果我正確理解你的話,你認爲UserInfo的終點應該返回你項目的支持範圍? – DaImTo

+0

@DalmTo對不起,我很清楚我在想,既然我已經請求並被授予訪問每個範圍的權限,那麼UserInfo端點應該返回每一個支持的索賠 - 而不僅僅是索賠的一個子集。 –

回答

0

您不會總是找回所有受支持的聲明。支持的聲明意味着 - 他們受到支持。什麼決定了它們是否從用戶信息終端返回,如果你的用戶具有這些關聯聲明的值。此外,Google也可能會篩選出與用戶沒有直接關係的聲明......因爲畢竟它是userinfo終端。