Unable to request /wiki/rest/api/content/search api within a forge app

Hi,

Eventhough I’m using the scope indicated in the documentation (search:confluence) I haven’t been able to query the search api via @forge/api and keep receiving the same error : 401 Unauthorized: scope not does not match

The scope is correctly detected when I deploy or install the app. But a call to api.asUser().requestConfluence(/wiki/rest/api/content/search?cql=type=page&limit=25) systematically fails. Same asApp()

I’ve also tried to remove the scope from my manifest hoping forge lint would help me, but it doesn’t raise any error as it did with other scopes.

Any idea how to debug this a know which scope is expected ?

Cheers,

Sebastien

EDIT: Ticket created on ecosystem tracker FRGE-348

1 Like

Just found out the problem comes from the expand params I was adding : expand=body.view,metadata.currentuser.lastmodified. As soon as I add any of them, I get the scope error
Now the more questions remain. Why would it need different scopes given the query params used ? What scopes ?

1 Like

I managed to find a workaround with assumeTrustedRoute instead of route.

1 Like