OAuth 2.0 is not enabled for method: GET /rest/api/3/user/groups?accountId=12333

Hi Everyone,

My customui app is trying to call

GET /rest/api/3/user/groups?accountId=12333....

But the resolver is returning OAuth 2.0 is not enabled for method. The Jira docs show that having read:jira-user permissions in the manifest should allow this, and 20 or 30 other API routes are all working for me. Is getting the groups the current user is in not available with CustomUI?

This is my code:

async function getUserGroups(accountId) {
    const groups = await fetchUserGroupsFromAPIAsUser(`/rest/api/3/user/groups?accountId=${accountId}`);    
    console.log(`Groups = ${JSON.stringify(groups)}`);

    return groups.map((g) => {
        return {
            groupId: g.groupId

async function fetchUserGroupsFromAPIAsUser(apiRoute) {
    console.log(`Calling ${apiRoute}`)
    const payload = await api.asUser().requestJira(route`${apiRoute}`);
    const json = await payload.json();   
    console.log(`json = ${JSON.stringify(json)}`);
    return (json.groups) ? json.groups.items : []; 

Any help would be greatly appreciated!

Hi @BenPierce ,

Welcome to the Atlassian Developer Community.

The error message you are receiving is misleading. route is a tagged template function and it treats constant strings differently from ${} expressions. This is similar to the problem discussed here.

Here is some code to help you through this:

import api, { route } from '@forge/api';

async function fetchUserGroupsFromAPIAsUser(accountId) {
  console.log(`Getting groups for account ${accountId}...`)
  const payload = await api.asUser().requestJira(route`/rest/api/3/user/groups?accountId=${accountId}`);
  const json = await payload.json();
  console.log(`json = ${JSON.stringify(json, null, 2)}`);
  return (json) ? json : [];

exports.handleEvent = async (event, context) => {
  console.log(event, context);
  const accountId = event.atlassianId;
  const groups = await fetchUserGroupsFromAPIAsUser(accountId);
  console.log(`Groups = ${JSON.stringify(groups)}`);
  return {
    hello: "world"


Dugald, thank you so much for the explanation – I didn’t realize route was a template function that was encoding the ? character. This did indeed fix the issue and I’m now unblocked. Again many thanks for the reply!