Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uber API - Missing scope: request

Tags:

uber-api

I am making a request to https://sandbox-api.uber.com/v1/requests using the Bearer token for my account (which is the admin of the Uber app).

When I make the request I get a 401:

{
    "message": "Missing scope: request",
    "code": "unauthorized"
}

As I've said, the access_token I have is for the email address that is registered as the app admin so this request should work right?

like image 856
George Harnwell Avatar asked Apr 08 '15 12:04

George Harnwell


2 Answers

Yes when you call https://login.uber.com/oauth/authorize

you should request "&scope=profile%20history_lite%20history%20request"

like image 137
sim_on Avatar answered Sep 21 '22 16:09

sim_on


If you try this repo on Github which is a thin wrapper for Uber APIs, you can make requests easily.

Or you can do the scope thing yourself if you have the OAuth2 framework, what you can do is pass in the necessary scope strings into below API:

[[NXOAuth2AccountStore sharedStore] setClientID:_clientID
                                         secret:_clientSecret
                                          scope:[NSSet setWithObjects:@"request", @"history_lite", @"profile", @"request_receipt", nil]
                               authorizationURL:[NSURL URLWithString:@"https://login.uber.com/oauth/authorize"]
                                       tokenURL:[NSURL URLWithString:@"https://login.uber.com/oauth/token"]
                                    redirectURL:[NSURL URLWithString:_redirectURL]
                                  keyChainGroup:nil
                                 forAccountType:_applicationName]; 
like image 30
Boris Avatar answered Sep 17 '22 16:09

Boris