Create a worklog with a defined author with REST API and JWT

Hi!

I can successfully create new worklog entries via the JWT generated for my addon.

The only problem is that the author is always saved as my addon, not the person defined in the author key in the JSON payload.

This is what I’m sending:

  comment: "Some comment",
  timeSpentSeconds: 360,
  author: {
    accountId: '557058:5d74ad9c-[edited]',
    key: 'piotr',
    displayName: "Piotr Usewicz",
    name: 'piotr'
  }

The data matches what I’d get when looking up the user details via the REST API too.

What am I doing wrong?

I think you need to ACT_AS_USER. It’s a more complicated authentication flow but should allow your app to POST worklogs on behalf of other users.

2 Likes