Uber API:在请求或发出令牌时指定多个范围返回无效的请求参数 [英] Uber API: Specify multiple scopes while requesting or issuing a token returns Invalid Request Paramenters
问题描述
我知道 OAuth 2.0 规范允许在请求或发布令牌时指定多个范围,但 Uber 不喜欢多个范围.
I know that the OAuth 2.0 specs allows to specify multiple scopes while requesting or issuing a token, but Uber doesn't like the multiple scopes.
例如:
1) [没有错误]
参数 = {
'response_type': 'code',
'redirect_uri': 'INSERT_ROUTE_TO_STEP_TWO',
'scope': 'profile',
}
返回正确的令牌,我可以通过'https://api.uber.com/检索用户个人资料v1/我'
Returns correct token and I can retrieve the user profile via 'https://api.uber.com/v1/me'
2) [错误]
参数 = {
'response_type': 'code',
'redirect_uri': 'INSERT_ROUTE_TO_STEP_TWO',
'scope': 'profile%20history',
}
Uber 返回无效的请求参数".我试过 'scope': 'profile%20history' 和 'scope': 'profile history'.两种情况都返回相同的错误.
Uber returns "Invalid Request Parameters". I tried 'scope': 'profile%20history' and 'scope': 'profile history'. Both cases returns the same error.
我是一名 Android 开发者,使用 https://github.com/twotoasters/AndrOAuth 作为测试.
I'm an Android developer using https://github.com/twotoasters/AndrOAuth as a test.
谢谢
推荐答案
Scope 使用空格分隔符.
Scope uses space delimiters.
您应该将范围作为 'scope': 'profile history'
传递,并让底层 http 库处理 URI 转换,而不是由您自己明确地进行.
You should pass scope as 'scope': 'profile history'
and let the underlying http library handle the URI conversion rather than doing it explicitly by yourself.
这篇关于Uber API:在请求或发出令牌时指定多个范围返回无效的请求参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!