> ## Documentation Index
> Fetch the complete documentation index at: https://nango.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# How to register your own Confluence OAuth app

> Register an OAuth app with Confluence and obtain credentials to connect it to Nango

This guide shows you how to register your own app with Confluence (Atlassian) to obtain your OAuth credentials (client id & secret). These are required to let your users grant your app access to their Confluence account.

<Steps>
  <Step title="Create an Atlassian developer account">
    If you don't already have one, sign up for an [Atlassian developer account](https://id.atlassian.com/signup/).
  </Step>

  <Step title="Create a new OAuth 2.0 (3LO) app">
    1. Go to the [Atlassian Developer Console](https://developer.atlassian.com/console/myapps/).
    2. Click **Create** and select **OAuth 2.0 integration**.
    3. Enter a name, agree to Atlassian's developer terms by checking the agreement checkbox for your app and click **Create**.
    4. Your app will be created and you'll be taken to the app management page.
  </Step>

  <Step title="Configure OAuth 2.0 (3LO)">
    1. In the left sidebar, select **Authorization**.
    2. Next to OAuth 2.0 (3LO), click **Add**.
    3. Enter `https://api.nango.dev/oauth/callback` as the Callback URL.
    4. Click **Save** to save your changes.
  </Step>

  <Step title="Add API permissions">
    1. In the left sidebar, select **Permissions**.
    2. Find the Confluence API and click **Add**, and then click **Configure**.
    3. Click **Edit Scopes** then select the scopes your application requires. Common scopes include:
       * `read:confluence-user` - Read user information
       * `read:confluence-content.all` - Read all content
       * `read:confluence-content.summary` - Read content summaries
       * `write:confluence-content` - Create and update content
       * `delete:confluence-content` - Delete content
       * `manage:confluence-configuration` - Manage Confluence instance settings
       * `read:page:confluence` - Read Confluence pages
       * `offline_access` - Get refresh tokens (required for long-term access)
    4. Click **Save** to save your changes.
  </Step>

  <Step title="Obtain your client credentials">
    1. In the left sidebar, select **Settings**.
    2. Note your **Client ID**.
    3. Copy both the Client ID and Secret by clicking the copy buttons next to them, as you'll need them when configuring your integration in Nango.
  </Step>

  <Step title="Make your app available to users (optional)">
    If you want to distribute your app to other users:

    1. In the left sidebar, select **Distribution**.
    2. In **Distribution controls**, click the **Edit** button, then select the **Sharing** radio button.
    3. Return to the Authorization page and copy the Authorization URL to share with your users.

    Note: By default, your app is private and can only be used by you. Making it public allows other users to authorize your app.
  </Step>
</Steps>

<Note>Changes to your OAuth 2.0 (3LO) app can take a few minutes to propagate.</Note>

## Important notes for Confluence API

When working with the Confluence API through Nango, keep these important points in mind:

**Refresh token requirement:**
To allow the possibility of refreshing the token, you must add `offline_access` to your scopes when creating the integration on the Nango UI.

**Cloud ID and domain configuration:**
A single Confluence OAuth token can be valid for multiple Atlassian sites. For example, the same token might grant access to both "nango-hq.atlassian.net" and "nango-test.atlassian.net". This is why specifying the `domain` during connection creation is important if you need to connect to a specific site.

When connecting to Confluence, you have two options for specifying which Confluence site to connect to:

1. Provide a `domain` during connection creation (recommended): This ensures you connect to the specific Confluence site you want.
2. Let Nango auto-select the first available site (legacy behavior): If no baseUrl is specified, Nango will use the first site from the accessible resources api.

The connection process works as follows:

1. Nango fetches all accessible sites for the OAuth token
2. If you specified a `domain`, Nango finds the matching site and sets its `cloudId`
3. If no `domain` is specified, Nango uses the first available site and sets its `cloudId`
4. The selected site's `cloudId` and `domain` are stored in the connection configuration

You will need to fetch your Cloud ID to be able to make API requests to the Confluence API. You can do this with the proxy by calling:

```ts theme={null}
const response = await nango.get({
    endpoint: `oauth/token/accessible-resources`,
    baseUrlOverride: 'https://api.atlassian.com'
});
const cloudId = response.data[0].id;
```

You can then construct your URL as follows: `https://api.atlassian.com/ex/confluence/${cloudId}/wiki/rest/api/<endpoint>`

**App distribution:**
When you create an OAuth 2.0 (3LO) app, it's private by default. Before using the integration, you must make your app public. See [Distributing OAuth 2.0 Apps](https://developer.atlassian.com/cloud/confluence/oauth-2-3lo-apps/#distributing-your-oauth-2-0--3lo--apps) for details.

**Refresh token expiration:**
Refresh tokens will expire after 365 days of non use and will expire by 90 days if the resource owner is inactive for 90 days. Make sure you call `nango.getConnection()` at least every 365 days to trigger a refresh. See [Atlassian's OAuth documentation](https://developer.atlassian.com/cloud/jira/platform/oauth-2-3lo-apps/#how-do-i-get-a-new-access-token--if-my-access-token-expires-or-is-revoked-) for more details.

**Rotating refresh tokens:**
Confluence's OAuth implementation uses rotating refresh tokens. Each time you refresh an access token, you'll receive a new refresh token that invalidates the previous one.

**User permissions:**
When making API calls, remember that the permissions of the user who authorized your app will limit what your app can do, regardless of the scopes you've requested.

**Shared OAuth infrastructure:**
Confluence and Jira share the same OAuth infrastructure, so the OAuth setup process is identical for both products.

For more details on Confluence's OAuth implementation and API, see the [Confluence Cloud Platform Documentation](https://developer.atlassian.com/cloud/confluence/).

***
