我正在写完全简单的JS代码来连接Evernote沙盒,这和在 文件:
const Evernote = require("evernote");
const client = new Evernote.Client({
token: "here-is-my-developer-token1234",
sandbox: true
});
const userStore = client.getUserStore();
userStore.getUser().then(function(user) {
console.log(user)
});
不过,我收到一个关于CORS政策的错误,我想,这意味着我的认证因某种原因而失败。
Access to fetch at 'https://sandbox.evernote.com//edam/user' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
我从那里得到了我的令牌 I've got my token from there: https:/sandbox.evernote.comapiDeveloperToken.action。
也许我还缺少一些基本的东西。任何指导都将被感激。
在JS SDK中可以看到 文件,他们不支持CORS,也就是头认证。所以你需要使用oauth。