简体   繁体   English

如何使用node.js获取uber api访问令牌

[英]how to get uber api access token using nodejs

I am posting following data to [ https://login.uber.com/oauth/v2/token] my code:- 我正在将以下数据发布到[ https://login.uber.com/oauth/v2/token]我的代码:-

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"} 但是它给我的回应是{“错误”:“ invalid_client”}

Use this node wrapper for the Uber API. 将此节点包装用于Uber API。 It appears to be the most advanced one and I recently added support for payment-methods and places . 它似乎是最先进的一种,最近我增加了对payment-methodsplaces

You can also check out my sample code from Take Me Home Now! 您也可以从“立即带我回家”中查看我的示例代码

use a package that supports oauth. 使用支持oauth的软件包。 It will be easier to deal with 处理起来会更容易

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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