Uber API: Specify multiple scopes while requesting or issuing a token returns Invalid Request Paramenters

烈酒焚心 提交于 2019-12-24 04:37:05

问题


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.

For example:

1) [No error]

parameters = {

'response_type': 'code',
'redirect_uri': 'INSERT_ROUTE_TO_STEP_TWO',
'scope': 'profile',

}

Returns correct token and I can retrieve the user profile via 'https://api.uber.com/v1/me'

2) [Error]

parameters = {

'response_type': 'code',
'redirect_uri': 'INSERT_ROUTE_TO_STEP_TWO',
'scope': 'profile%20history',

}

Uber returns "Invalid Request Parameters". I tried 'scope': 'profile%20history' and 'scope': 'profile history'. Both cases returns the same error.

I'm an Android developer using https://github.com/twotoasters/AndrOAuth as a test.

Thanks


回答1:


Scope uses space delimiters.

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.




回答2:


I'm sure you figured this out by now, but you are using a space to delimit your scope arguments and the api calls for a comma.



来源:https://stackoverflow.com/questions/25457242/uber-api-specify-multiple-scopes-while-requesting-or-issuing-a-token-returns-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!