You are right, that the scopes are correct for the request.
Are you sure that the app was installed for Confluence and not for Jira?
If that’s the case, can you share the invocation id for that request for us to check?
I see now that the request is done using the requestConfluence bridge from a customUI.
In that case, the easiest way to check the scopes of the request is to do the following:
from the https://api.atlassian.com/ex/confluence//wiki/rest/api/content request in the browser developer tools, get the authorization token from the request headers
decode it (for example you could be using a tool like https://jwt.io, note the security warnings there though) and check for the scope attribute
Do you see the required read:content-details:confluence and write:content:confluence scope?
If not, we should try to re-deploy and re-install the app (a forge install --upgrade will be required if the scope has been added afterwards).
Another option, which will not tell us what happened but might resolve the problem, could be to create a brand new app with the same code by using the forge register command. This will generate a new app with a new id and the app will need to be reinstalled on the sites.
I also did some checks to see if there could have been something else happening (e.g. the user didn’t have the permission to create blogs) but the only time when the request returned a 401 was when the scopes were missing.
Regarding the invocation id, that is what is shown in the forge tunnel when a request is performed. With that information, we have a way to check the scopes attached to a request. However, this doesn’t apply to customUI.
For example, in my console I get the following based on the example below and the d3225a64c43416e1 is the invocation id: invocation: d3225a64c43416e1 index.run
I had a quick look at the logs and still couldn’t find an explanation for this (I’ll dig more next week).
In the meantime, I have 2 more questions for you:
In the payload in the original request, I see type: "content". This should be type: "blogpost", right?
Can you also confirm that the ba9609c0922e4d91 invocation returned the same 401 - Unauthorized, scope does not match? And was that using the asApp or the asUser request?
And one more:
Do you know if this happens on every site? Maybe you tried a few and could reproduce it consistently on all of them.