OAuth 2 端点:附加字段?
OAuth 2 Endpoint: Additional Fields?
在 OAuth 令牌端点响应中包含其他字段是否可以接受?
例如,我在下面返回 UserId
、Username
和 CompanyId
:
{
"access_token": "pHd4Wz1EF...",
"token_type": "bearer",
"expires_in": 86399,
"UserId": "7e7fbc39-8abd-41e1-b165-9d18b635b7a7",
"Username": "user@somewhere.com",
"CompanyId": "874f380a-76eb-49b1-81b5-a42100f7e4d0",
}
这实质上意味着不需要额外的请求来获取此信息。
您可以这样做 - 但更标准化的解决方案是为此目的使用 "OpenID Connect"(参见 http://openid.net/connect/)。
在 OAuth 令牌端点响应中包含其他字段是否可以接受?
例如,我在下面返回 UserId
、Username
和 CompanyId
:
{
"access_token": "pHd4Wz1EF...",
"token_type": "bearer",
"expires_in": 86399,
"UserId": "7e7fbc39-8abd-41e1-b165-9d18b635b7a7",
"Username": "user@somewhere.com",
"CompanyId": "874f380a-76eb-49b1-81b5-a42100f7e4d0",
}
这实质上意味着不需要额外的请求来获取此信息。
您可以这样做 - 但更标准化的解决方案是为此目的使用 "OpenID Connect"(参见 http://openid.net/connect/)。