简体   繁体   中英

how to get uber api access token using nodejs

I am posting following data to [ https://login.uber.com/oauth/v2/token] my code:-

var postData = {
url:'https://login.uber.com/oauth/v2/token',
headers:{"Authorization":"Token "+uberServerToken},
 qs:{
  client_secret:uberClientSecret,
  client_id:uberClientID,
  grant_type:'authorization_code',
  redirect_uri:redirectURIforAccessToken,
  code:req.query.code
 }
}; 
request.post(postData,function(err, response, body){
 if(err){
 console.log("Error @ POSTING:"+err);
 }else {
 console.log("body:"+body);
 res.end();
 }
});

but it is giving me response as {"error": "invalid_client"}

Use this node wrapper for the Uber API. It appears to be the most advanced one and I recently added support for payment-methods and places .

You can also check out my sample code from Take Me Home Now!

use a package that supports oauth. It will be easier to deal with

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM