使用开发人员令牌的 Evernote 身份验证失败
Evernote authentification with developer token failed
我正在编写完全简单的 JS 代码来连接到 Evernote 沙箱,这与 documentation 中的代码非常相似:
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.
我从那里得到了我的令牌:https://sandbox.evernote.com/api/DeveloperToken.action
也许我缺少一些基本的东西。任何指导将不胜感激。
正如你在JS SDK docs中看到的那样,它们不支持CORS,即header认证。所以你需要使用oauth。
我正在编写完全简单的 JS 代码来连接到 Evernote 沙箱,这与 documentation 中的代码非常相似:
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.
我从那里得到了我的令牌:https://sandbox.evernote.com/api/DeveloperToken.action
也许我缺少一些基本的东西。任何指导将不胜感激。
正如你在JS SDK docs中看到的那样,它们不支持CORS,即header认证。所以你需要使用oauth。