I'm using Node-uber to communicate with the Uber API. I have to following code (almost exact copy of the sample code for the project, keys are hidden)
var uber = new Uber({
client_id: 'XXXXXXXXXXXX',
client_secret: 'XXXXXXXXXXXXX',
server_token: 'XXXXXXXXXXXX',
redirect_uri: 'https://localhost:3002/rides/callback',
name: 'app name',
language: 'en_US',
sandbox: true
});
router.get('/login', function(request, response) {
var url = uber.getAuthorizeUrl(['request']);
console.log(url);
response.redirect(url);
});
router.get('/callback', function(req, res, next) {
uber.authorization({
authorization_code: req.query.code
}, function(err, access_token, refresh_token) {
if (err) {
console.error(err);
} else {
res.redirect('/dashboard/pages/index.html');
}
});
});
Now, when I'm trying to login with my Uber developer credentials (same one I used to create the app on Uber), everything works perfectly, which leads me to believe the implementation makes at least basic sense.
The problem is when I try another, unrelated, Uber login. Then the error code coming back is invalid_grant
The issue is you are requiring the 'request' scope which is a privileged scope.
The good news is you currently have access to these scopes when authorizing your own account or those of the developer accounts you list in the developer dashboard. When you're ready to open up your app to a larger audience and go into production, please submit a request for Full Access from the developer dashboard.
Find out more in the scopes docs: https://developer.uber.com/docs/rides/scopes