This endpoint requires at least one of the following scopes: all_trips_lite, request, all_trips

孤街浪徒 提交于 2019-12-18 09:37:48

问题


I am doing authentication from Uber SDK

https://sandbox-api.uber.com/v1.2/requests/current

but when I add "Authorization" , "Accept-Language" , "Content-Type" it returns this message

{
    "message": "This endpoint requires at least one of the following scopes: all_trips_lite, request, all_trips",
    "code": "unauthorized"
}

any one can help me to get out from this problem


回答1:


Related to your integration you will need the user to grant access to your application through the OAuth 2.0 Authorization Code flow.

The Authorization Code flow is a two-step authorization process. The first step is having the user authorize your app and the second involves requesting an OAuth 2.0 access token from Uber. This process is mandatory if you want to take actions on behalf of a user or access their information.

The redirect URL "YOUR_REDIRECT_URI" is the URL we will redirect back to after an authorization by the resource owner. The base of the URI must match the redirect_uri used during the registration of your application. If none is provided the default is the first redirect URI provided in the application's dashboard "YOUR_LIST_OF_SCOPES" is the list of scopes you have requested in the authorizations tab. Based what you want to achieve and what API calls you want to make - you will need the certain scope to be used in your two-step authorization process. You can use multiple scopes as comma delimited list.

Please follow the steps of the authentication guide.

Briefly, you need to:

• Send user to authorize url. It starts by redirecting the user to the authorize endpoint: https://login.uber.com/oauth/v2/authorize?client_id=YOUR_CLIENT_ID&response_type=code&redirect_uri=YOUR_REDIRECT_URI&&scope=YOUR_LIST_OF_SCOPES . 

• Receive the redirect with an authorization code. After the user approves the scopes the user will be redirected to the redirect_uri with an auth code that you can post to the /v2/token endpoint to receive an access token.

• Make a POST call to: 'https://login.uber.com/oauth/v2/token'

As a result, you will get access_token, and refresh_token. Use this access_token when you call https://sandbox-api.uber.com/v1.2/requests/current endpoint.

For more info please check online documentation.



来源:https://stackoverflow.com/questions/45729991/this-endpoint-requires-at-least-one-of-the-following-scopes-all-trips-lite-req

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