Assigning an issue using REST API not working

Hello community!

I am currently working on a Forge app that automatically assigns new issues to specific users. While I can assign issues to users manually within Jira Service Managment, this does not work when using the REST API (https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-assignee-put)

The response I get is

{
  errorMessages: [ 'You do not have permission to assign issues.' ],
  errors: {}
}

which is kinda weird as assigning issues manually works just fine.
According to the documentation, Browse Projects and Assign Issues need to be configured for the project, and I think I have done that correctly. I have also checked the permissions using the API as well (https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-permissions/#api-rest-api-3-mypermissions-get) with the following result:

{
  permissions: {
    BROWSE_PROJECTS: {
      id: '10',
      key: 'BROWSE_PROJECTS',
      name: 'Browse Projects',
      type: 'PROJECT',
      description: 'Ability to browse projects and the issues within them.',
      havePermission: true
    },
    ASSIGN_ISSUES: {
      id: '13',
      key: 'ASSIGN_ISSUES',
      name: 'Assign Issues',
      type: 'PROJECT',
      description: 'Ability to assign issues to other people.',
      havePermission: true
    }
  }
}

Here is the code I’m using in my app to try to assign issues:

public async assignRequestToAgent(issueId: number, userId: string): Promise<void> {
        let body: string = `{
            "accountId": "${userId}"
        }`;

        const response = await API.asApp().requestJira(route`/rest/api/3/issue/${issueId}/assignee`, {
            method: "PUT",
            headers: {
                "Accept": "application/json",
                "Content-Type": "application/json"
            },
            body: body
        });

        console.log(`Response: ${response.status} ${response.statusText}`);
        console.log(await response.json());
    }

Can someone please point me in the right direction on how to solve this?
Thanks!

Have you added the write:jira-work scope to your app?

Here’s docs on Forge scopes to call an API Add scopes to call an Atlassian REST API

Yes, I did (forgot to mention this, sorry for that). Here is the relevant part of the manifest.yml

permissions:
  scopes:
    - write:jira-work
    - read:jira-work
    - read:jira-user
    - storage:app

It seems like this issue was related to [FRGE-212] App permissions on Jira projects and Confluence spaces for asApp authentication are not configured after Forge app installation - Ecosystem Jira
After re-deploying and re-installing the app it is working fine now.