I am working on integrating Confluence with my application using the OAuth2 authentication method. I have successfully implemented the OAuth flow, obtained the access token, and can hit the Confluence API endpoints. However, I am encountering an issue where I am unable to list the spaces unless I manually enable anonymous access in the space settings and the general site settings.
Despite having the necessary scopes and using the access token, the API does not return any spaces unless anonymous access is enabled. Here is an overview of my OAuth integration process:
- Initiate OAuth flow to get authorization code.
- Exchange authorization code for access token.
- Use the access token to hit the
https://api.atlassian.com/oauth/token/accessible-resources
endpoint to retrieve the user’s accessible resources. - Use the accessible resource URL to hit the
/wiki/rest/api/space
endpoint to list spaces.
Unless I manually set anonymous access, the /wiki/rest/api/space
endpoint returns empty results.
Is there any additional configuration or permissions required to access the spaces using the OAuth access token without enabling anonymous access? Any guidance or assistance would be greatly appreciated.