使用NodeJS使用OAuthunit testingMobileFirst Platform Java适配器

我正在编写一个NodeJS应用程序来testing我写的IBM MobileFirst Platform适配器。 我想遵循的方法做到这一点,如下所示:

  1. 从http:// localhost:10080 / AppName / authorization / v1 / testtoken获取testing令牌
  2. 使用此不记名令牌对我受保护的适配器进行authentication请求。

方法的问题是,当我尝试向testtoken端点发出请求时,出现HTTP 405状态错误。 但是,PostMan也一样。

有没有办法使这个工作在NodeJS应用程序? 我正在使用请求发送请求到MobileFirst服务器。

我正在使用SailsJs编写我的NodeJS应用程序。

testing令牌操作需要POST请求。

request.post('http://localhost:10080/app/authorization/v1/testtoken', function(error, response, body) { console.log(response.statusCode); if(!error && response.statusCode == 200) { console.log(body); return res.ok(body); } else { return res.notFound(error); } }); 

在我的情况下,我使用请求,所以上面的代码工作。