node-moodle-client icon indicating copy to clipboard operation
node-moodle-client copied to clipboard

Invalid token when POSTING Json data

Open Milanw2 opened this issue 8 years ago • 2 comments

I'm getting this error when I'm uploading users:

<?xml version="1.0" encoding="UTF-8" ?>
<EXCEPTION class="moodle_exception">
<ERRORCODE>invalidtoken</ERRORCODE>
<MESSAGE>Invalid token - token not found</MESSAGE>
</EXCEPTION>

And this is my code:

function send_users_to_moodle(client, Json, count, x) {
    client.call({
        wsfunction: "core_user_create_users",
        method: "POST",
        args: {
            Json
        }
    }).then(function (info) {
        console.log(info);
    });
};

Milanw2 avatar May 15 '17 10:05 Milanw2

This happens when I'm trying to add more then 200+- users and when there are errors in the data, like null. But it doesn't give me an error about that, but about the invalid token. Please help. thanks in advance

Milanw2 avatar May 15 '17 16:05 Milanw2

Are you able to monitor the server side too? To see if/what error was thrown in Moodle?

mudrd8mz avatar Jun 16 '17 20:06 mudrd8mz