Reputation: 11
API Curl:
curl --location 'https://login.uber.com/oauth/v2/token' \
\--header 'Content-Type: application/x-www-form-urlencoded' \
\--data-urlencode 'client_secret=SECRET_FROM_APPLICATIONS_DASHBOARD' \
\--data-urlencode 'client_id=CLIENTID_FROM_APPLICATIONS_DASHBOARD' \
\--data-urlencode 'grant_type=client_credentials' \
\--data-urlencode 'scopes=guests.trips'
Documentation Link : https://developer.uber.com/docs/guest-rides/guides/authentication
I am expecting it to give :
{
"access_token": "{TokenValue}",
"token_type": "Bearer",
"expires_in": 2592000,
"scope": "guests.trips"
}
but I am getting this as output in postman :
{
"error": "invalid_scope",
"error_description": "scope(s) are invalid"
}
I am not making any other API call other than mentioned above. Do I need to do anything prior to calling this endpoint if not then why invalid scopes is coming as output.
Upvotes: 1
Views: 2206
Reputation: 56
It looks like the scope request parameter has a syntax error. It should be 'scope' and not 'scopes'. This is also why you get the error_code 'invalid_scope', likely because it is unknown as of OAuth Spec.
You can have a look at ubers own API documentation, where they have an excellent example of client_credentials as well.
Upvotes: 1