I encountered an error in findNotesMetadata(). below are two routes:

Get notebooks:

router.get('/getEvernote', (req, res) => {
    var client = new Evernote.Client({ token: globaloauthAccessToken, sandbox: true, china: false });
    var noteStore = client.getNoteStore();
    noteStore.listNotebooks().then(function (notebooks) {
        var output = {
            message: 'Success.',
            notebooks: notebooks
        }
        res.json(output);
        return;
    })
})

Above piece of code is working well, I can get data like if I directly call http://localhost:3000/api/getEvernote:

{
  "message": "Success.",
  "notebooks": [
    {
      "guid": "XXXXX",
      "name": "XXX",
      "updateSequenceNum": 28,
      "defaultNotebook": true,
      "serviceCreated": 1546454274000,
      "serviceUpdated": 1557700199000,
      "publishing": null,
...

However, below route is not working:

Get all Notes meta data:

router.get('/getNotes', (req, res) => {
    var client = new Evernote.Client({ token: globaloauthAccessToken, sandbox: true, china: false });
    var noteStore = client.getNoteStore();
    const filter = new Evernote.NoteStore.NoteFilter({
        ascending: false,
    });

    const spec = new Evernote.NoteStore.NotesMetadataResultSpec({
        includeTitle: true
    });

    noteStore.findNotesMetadata(filter, 0, 100, spec)
        .then(data => {
            var output = {
                message: 'Success.',
                data: data
            }
            res.json(output);
            return;
        })
        .catch(err => {
            console.log(err)
        });
})

In the above code, I can only receive an error like:

ThriftException { errorCode: 3, parameter: 'authenticationToken' }

I was thinking it could be that my API key is a basic version, not full permission, so I requested a new one, with full permission, but the error is still the same. What is errorCode 3 mean?

Any help would be very much appreciated.

0 Answers