为什么github API使用token
而不是Bearer
作为授权类型?
请参阅github.js第61行
答案 0 :(得分:1)
我检查了Github OAuth指南,发现response to successful authorization request采用以下形式:
access_token=e72e16c7e42f292c6912e7710c838347ae178b4a&scope=user%2Cgist&token_type=bearer
,其中token_type为bearer
。
但在Use the access token to access the API中,请求方法是将其包含在Authorization标头中:
Authorization: token OAUTH-TOKEN
正如The OAuth 2.0 Authorization Framework所说:
每个访问令牌类型定义指定其他属性 (如果有的话)与“access_token”响应一起发送给客户端 参数。 它还定义了用于的HTTP身份验证方法 在发出受保护资源请求时包括访问令牌。
持票人是standard Authentication Scheme。
我没有使用token
作为方案找到任何其他OAuth实现。
所以这很有趣,我希望Github的一些人能够对此进行思考。