获取印象笔记开发token出错401,求助~
发布于 6 年前 作者 DevinXian 4072 次浏览 最后一次编辑是 4 年前

先上自己的代码,其实和readme中的一模一样… var Evernote = require(“Evernote”).Evernote; var client = new Evernote.Client({ consumerKey: My_Consumer_Key, consumerSecret: My_Consumer_Secret }); client.getRequestToken(‘http://220.231.xx.xx/getToken.html’, function (error, oauthToken, oauthTokenSecret, results) { console.log(“oauthToken:” + oauthToken); console.log(“oauthTokenSecret:” + oauthTokenSecret); console.log(’-----------获取token---------------------’); client.getAccessToken(oauthToken, oauthTokenSecret, function (error, oauthAccessToken, oauthAccessTokenSecret, results) { // store ‘oauthAccessToken’ somewhere console.log(error); console.log(“oauthAccessToken:” + oauthAccessToken); console.log(“results:” + results); }); }); 遇到问题:第二次访问返回结果为:statusCode: 401。 对比evernote模块readme来做,没搞定,诚心求教~~为了方便,贴出readme相关代码: npm install evernote

### OAuth ###
```javascript
var client = new Evernote.Client.new({
  consumerKey: 'YOUR API CONSUMER KEY',
  consumerSecret: 'YOUR API CONSUMER SECRET',
  sandbox: [true or false] // Optional (default: true)
});
client.getRequestToken('YOUR CALLBACK URL', function(error, oauthToken, oauthTokenSecret, results) {
  // store tokens in the session
  // and then redirect to client.getAuthorizeUrl(oauthToken)
});

To obtain the access token

client.getAccessToken(oauthToken, oauthTokenSecret, oauthVerifier, function(error, oauthAccessToken, oauthAccessTokenSecret, results) {
  // store 'oauthAccessToken' somewhere
});
请注意oauthVerifier参数,不知道从哪里获取- -第一步返回结果确实木有~最近几天gogole上不去,特来坛子问问各路大神~
回到顶部