Help with POST Form on Conflunce Addon


I am trying to do a post form for a add on i am building but dont get it to work.

i get a error when i press the submit button:

Authentication verification error: 401 Could not find authentication data on request
POST /macro 401 26.863 ms - 777
GET /atlassian-connect/all-debug.js 404 1.917 ms - 169

The GET route works.

Routes code:

 app.get('/macro', addon.authenticate(), function (req, res) {
 );'/macro', addon.authenticate() function (req, res) {

Form parameters:

<form class="aui" action="/macro" method="post">

Do anyone have a idea on what i do wrong?

Maybe need credentials?
Look here

Hmm but that don´t look like Atlassian-conncect-express with node js? Is not that for Jira Server?

Sorry, didn’t notice tag. Maybe that’/macro’, addon.checkValidToken(), function

Where does the error message come from? Your Node App or from the browser console?

I think it comes from Node, so the next thing to check is your addon.checkValidToken function. Can you show it to us?

If it is from the browser and therefore most likely an error coming from Jira, then i would try to send the Request over Atlassian Connect, so you could try

  type: "POST",
  url: "BASEURL/macro"
}, (err, data) => 
   // data == xml.responsebody i think :)

Notice you have to pass the absolute URL of your Node Backend because the Request will be send from Jiras Frame, therefore in * space.

Thank you for the response. i Both get the error in the node.js console and on the conflunce site where the macro is running. I dont know if there is a diffrence in this case but this is regarding Conflunce and not in Jira.

Do i need addon.checkValidToken when i use addon.authenticate()?