Skip to content

invalid_grant on request when obtaining access_token from somewhere else #70

@maakle

Description

@maakle

Hello,
I have an iOS App where I use SSO to authenticate the user and then save the accessToken & refreshToken locally to keychain on my device. Then I'm calling my server who uses a javascript background function to call your library to make a request to Uber.
So far, I'm trying to set up your library with my 2 local tokens like this:

 var uber = new uberClient({
    client_id: '...',
    client_secret: '...',
    server_token: '...',
    name: 'My App',
    sandbox: true, //optional
    access_token: accessToken,
    refresh_token: refreshToken
  });

afterwards I want to call the uber.requests.getEstimatesAsync endpoint like this:

uber.requests.getEstimatesAsync({
      "start_latitude": pickupLocation["lat"],
      "start_longitude": pickupLocation["lng"],
      "end_latitude": dropoffLocation["lat"],
      "end_longitude": dropoffLocation["lng"]
      })
      .then(function(res) { 
        console.log(JSON.stringify(res)); 
      })
      .error(function(err) { 
        console.error(err); 
      });
})

Though every time I get an "invalid_grant" error while doing this. Did I make a mistake authenticating myself or setting up the Uber client wrong? Is it even possible to add my local accessToken & refreshToken manually to your uber client?
I'm using a Developer account for doing this, therefore I should actually have all the required permissions for the request endpoint, but I also obtained them previously in the App.

Best regards,
Matt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions