为什么 Google 的 OpenId Connect API 没有发回所有声明?
Why is Google's OpenId Connect API not sending back all claims?
我查看了 Google 的 OpenId Connect 发现文档 here。它清楚地表明支持的声明是:
"claims_supported": [
"aud",
"email",
"email_verified",
"exp",
"family_name",
"given_name",
"iat",
"iss",
"locale",
"name",
"picture",
"sub"
]
支持的范围是
"scopes_supported": [
"openid",
"email",
"profile"
]
我希望当我向 OpenId Connect UserInfo end point (which is https://www.googleapis.com/oauth2/v3/userinfo) 发送 GET 请求时,我会取回所有受支持的声明(假设当我进行身份验证时,我请求了所有受支持的范围......当我发送初始请求时,我做了如下所示)
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
这是我在 UserInfo 端点请求的响应中得到的声明:
{
"sub": "...",
"name": "...",
"given_name": "...",
"family_name": "...",
"picture": "...",
"email": "...",
"email_verified": true,
"locale": "..."
}
注意它们是所有受支持声明的子集...谁能告诉我为什么我的回复中没有得到所有受支持的声明?
您不会总能取回所有支持的声明。 Supported claims 的意思就是——他们得到了支持。决定它们是否从 userinfo 端点返回的是您的用户是否具有这些关联声明的值。此外,Google 也可能会过滤掉与用户没有直接关系的声明...因为毕竟它是 userinfo 端点。
我查看了 Google 的 OpenId Connect 发现文档 here。它清楚地表明支持的声明是:
"claims_supported": [
"aud",
"email",
"email_verified",
"exp",
"family_name",
"given_name",
"iat",
"iss",
"locale",
"name",
"picture",
"sub"
]
支持的范围是
"scopes_supported": [
"openid",
"email",
"profile"
]
我希望当我向 OpenId Connect UserInfo end point (which is https://www.googleapis.com/oauth2/v3/userinfo) 发送 GET 请求时,我会取回所有受支持的声明(假设当我进行身份验证时,我请求了所有受支持的范围......当我发送初始请求时,我做了如下所示)
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
这是我在 UserInfo 端点请求的响应中得到的声明:
{
"sub": "...",
"name": "...",
"given_name": "...",
"family_name": "...",
"picture": "...",
"email": "...",
"email_verified": true,
"locale": "..."
}
注意它们是所有受支持声明的子集...谁能告诉我为什么我的回复中没有得到所有受支持的声明?
您不会总能取回所有支持的声明。 Supported claims 的意思就是——他们得到了支持。决定它们是否从 userinfo 端点返回的是您的用户是否具有这些关联声明的值。此外,Google 也可能会过滤掉与用户没有直接关系的声明...因为毕竟它是 userinfo 端点。