Error: invalid csrf token[resolved]


  • Though it is not a bug but some authentication problems with some plugin due to which they throw Error: invalid csrf token. I want to know in general which kind of issue within the plugins causes this error. And how to go about fixing this error.


  • @vatsal more context...It is happening while I am trying to upload the image through nodebb-plugin-imgur https://github.com/barisusakli/nodebb-plugin-imgur. As soon as I hit the "open" button from my browser file picker, I get this error inside my nodejs console log: (running in dev mode)

    Error: invalid csrf token
    at verifytoken (/Users/vats/Project/dealstan/forum/NodeBB/node_modules/csurf/index.js:234:13)
    at csrf (/Users/vats/Project/dealstan/forum/NodeBB/node_modules/csurf/index.js:94:7)
    at Layer.handle [as handle_request] (/Users/vats/Project/dealstan/forum/NodeBB/node_modules/express/lib/router/layer.js:76:5)
    at next (/Users/vats/Project/dealstan/forum/NodeBB/node_modules/express/lib/router/route.js:100:13)
    at Route.dispatch (/Users/vats/Project/dealstan/forum/NodeBB/node_modules/express/lib/router/route.js:81:3)
    at Layer.handle [as handle_request] (/Users/vats/Project/dealstan/forum/NodeBB/node_modules/express/lib/router/layer.js:76:5)
    at /Users/vats/Project/dealstan/forum/NodeBB/node_modules/express/lib/router/index.js:234:24
    at Function.proto.process_params (/Users/vats/Project/dealstan/forum/NodeBB/node_modules/express/lib/router/index.js:312:12)
    at /Users/vats/Project/dealstan/forum/NodeBB/node_modules/express/lib/router/index.js:228:12
    at Function.match_layer (/Users/vats/Project/dealstan/forum/NodeBB/node_modules/express/lib/router/index.js:295:3)
  • GNU/Linux Admin

    @vatsal Can you let us know your NodeBB and imgur plugin versions?


  • @julian said:

    Can you let us know your NodeBB and imgur plugin versions?

    i have the same error, my forum is down after that

    i have You are running NodeBB v0.5.2-dev. and imgur last version 😟

    edit :

    upload-e1618fd9-838b-4515-8f31-eedf2bf80902


  • @ffmad, this is part of the reason it's never a good idea to run dev builds in production. You should pull from the v0.5.x branch.


  • @Ted said:

    @ffmad, this is part of the reason it's never a good idea to run dev builds in production. You should pull from the v0.5.x branch.

    the v.0.5.x branch wasn't working at all compared to this dev version


  • upgrading to the latest version of nodebb-theme-lavender fixed this issue


  • @ffmad there had been a bad commit pushed a while back, but I've done a few pulls from v0.5.x and they've all been stable.
    @vatsal, good to hear that you resolved the matter.

Suggested Topics

| |