Open maakle opened 7 years ago
Hello, currently i have the same issue.
I also have same issue. Tried setting access_token with
uber.access_token = 'xxx'
and in init options and all the same, i always get "invalid_grant" error.
I'm using latest version of module.
So I think it's a problem with the library itself. Because once I made the request with http with the "request" library (https://github.com/request/request) it worked. Include for that at the top of your code:
var request = require('request');
Both OAuth2 and SSO accessToken worked. You should give the method a pickupLocation with latitude and longitude and your obtained accessToken from Uber like this:
function getAllAvailableUberProducts(pickupLocation, accessToken){
var lat = pickupLocation["lat"].toString();
var lng = pickupLocation["lng"].toString();
var options = {
uri: "https://api.uber.com/v1.2/products?latitude="+lat+"&longitude="+lng,
method: 'GET',
headers: {
"Authorization": "Bearer " + accessToken,
"Accept-Language": "en_US",
"Content-Type": "application/json"
}
};
request(options, function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(JSON.parse(body).products);
} else {
console.log(error);
}
});
}
I hope this helps someone.
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:
afterwards I want to call the uber.requests.getEstimatesAsync endpoint like this:
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