Unauthorized; scope does not match

Gerben Wierda
Contributor
March 7, 2023

I am using code like this:

console.log(`Space data id: ${sdata.results[0].id}`);
const pres = await api
.asUser()
.requestConfluence(route`/wiki/api/v2/spaces/${sdata.results[0].id}/pages`);

But the API call fails and the log says:

Space data id: 229380
Pages data: { "code": 401, "message": "Unauthorized; scope does not match" }

My manifest says:

permissions:
scopes:
- read:confluence-content.summary
- read:space:confluence
- read:confluence-content.all

How do I solve this such that I get an array of all pages of my space?

Note: I get the space id from a comparable call that does work:

.requestConfluence(route`/wiki/api/v2/spaces?keys=${spaceKey}`);

 

1 answer

1 vote
Matthias Gaiser _K15t_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 7, 2023

Hi @Gerben Wierda

first I'd like to advise you to use the Developer Community for such type of questions - you probably get better answers over there.

Having said that, I believe the API call fails due to a mismatching scope 😏. In the API docs, the scope for this method is read:page:confluence. You defined read:space:confluence.

I hope that helped already.

Cheers,
Matthias.
 

Gerben Wierda
Contributor
March 9, 2023

I am moving this to the developer community, but sadly it did not help.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events