2

I am trying to get access to data on the Uber API using R. I have created an account with their API and now have the following information assigned to me:

name of the app (I created this.) client id server token secret

I also have a username and password for my usual account, but I didn't think that I needed this for the API use. I am not sure that I am using the correct information for the correct arguments.

myapp=oauth_app("nameofmyapp",
            key="client id",
            secret="secret"
            )
sig=sign_oauth1.0(myapp,
              token="server token",
              token_secret="secret"
              )

homeTL=GET("https://api.uber.com/v1/products",
  sig
  )
homeTL
json1=content(homeTL)
json1

When I check to see what is in json1 (the last line) it appears as though the connection was never authenticated. I get

message
[1] "No authentication provided."

$code
[1] "unauthorized"

Any help would be appreciated. Thanks.

Grace
  • 181
  • 2
  • 8
  • run ethereal to find out if you're getting out to `uber` – KevinDTimm May 18 '15 at 16:53
  • @Grace, see this question(http://stackoverflow.com/questions/29460457/uber-api-ios-oauth-2-0/29504109#29504109) regarding Uber API auth. My answer is specific to iOS, though the steps should be the same in R. Hope that helps! – sun May 19 '15 at 19:18

1 Answers1

1

I haven't used Uber API, but it looks like a standard OAuth dance, which requires more steps than this. The docs indicate GET https://login.uber.com/oauth/authorize will be required (https://developer.uber.com/v1/auth/).

Even if you want to use the API programmatically, you'll still need to visit that URL once as a user in the browser, so you can pick up the authorization code (some random token string), which will be present when it redirects. That code is required in the actual API calls you want to make.

mahemoff
  • 44,526
  • 36
  • 160
  • 222