Reputation: 11
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
Upvotes: 0
Views: 1013
Reputation: 857
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.
Upvotes: 1