Establishing a Connection
Connecting to Confluence
You can establish a connection to any Confluence Cloud account or Confluence Data Center (on-premises) instance. To connect, you must set the URL connection property. For Confluence Cloud, the URL follows the format https://yoursitename.atlassian.net. For Confluence Data Center, set URL to the address of your self-hosted instance; for example, https://confluence.yourcompany.com.
Authenticating to Confluence
Confluence Cloud supports the following authentication methods: API token, OAuth, and single sign-on (SSO) via Crowd or Okta.Confluence Data Center supports the following authentication methods: Basic authentication, OAuth (custom OAuth application required), Personal Access Token (PAT) authentication (Confluence 7.9 or later), and SSO via Crowd or Okta.
API Token
Acquire a TokenAn API token is necessary for account authentication. To generate one, log in to your Atlassian account and select API tokens > Create API token. The generated token is displayed.
Authenticate Using the Token
To authenticate to a Cloud account, provide the following connection properties (Note: Password has been deprecated for connecting to a Cloud account and is now used only to connect to a Data Center instance.):
- AuthScheme: APIToken.
- User: The user to be used to authenticate with the Confluence server.
- APIToken: The API token associated with the currently authenticated user.
- URL: The URL associated with your Confluence endpoint. For example, https://yoursitename.atlassian.net.
Basic Authentication
To authenticate to a Data Center instance, specify the following properties:- AuthScheme: Basic.
- User: The user to authenticate with the Confluence instance.
- Password: The password which is used to authenticate with the Confluence server.
- URL: The URL associated with your Confluence endpoint. For example, https://confluence.yourcompany.com.
Note: Starting in Confluence Data Center v10.0, Basic authentication is disabled by default. Consider using Personal Access Token (PAT) or OAuth authentication instead.
OAuth
In all cases, you must set AuthScheme to OAuth and Scope to the value obtained from your application settings. In all the flows described below, it is assumed that you have done so. Note: OAuth 1.0 is deprecated in Confluence Cloud and should only be used by hosted Confluence users.Desktop Applications
For Confluence Cloud, CData provides an embedded OAuth application that simplifies authentication at the desktop. You can also authenticate from the desktop via a custom OAuth application. See Creating a Custom OAuth Application for more information.Get an OAuth Access Token
After setting the following, you are ready to connect:
- OAuthVersion: 2.0.
- URL: The URL to your Confluence endpoint; for example, https://yoursitename.atlassian.net.
- InitiateOAuth: GETANDREFRESH. You can use InitiateOAuth to avoid repeating the OAuth exchange and manually setting the OAuthAccessToken.
- OAuthClientId: The client Id in your application settings.
- OAuthClientSecret: The client secret in your application settings.
- CallbackURL: The redirect URL in your application settings.
- Extracts the access token from the callback URL and authenticates requests.
- Obtains a new access token when the old one expires.
- Saves OAuth values in OAuthSettingsLocation. These values persist across connections.
Web Applications
When connecting via a web application, you must register a custom OAuth application with Confluence. See Creating a Custom OAuth Application for more information. You can then use the provider to get and manage the OAuth token values.Get an OAuth Access Token
Set the following connection properties to obtain the OAuthAccessToken:
- OAuthClientId: The client Id in your application settings.
- OAuthClientSecret: The client secret in your application settings.
- OAuthVersion: 2.0.
- URL: The URL to your Confluence endpoint. For Cloud instances, for example, https://yoursitename.atlassian.net. For Data Center instances, for example, https://confluence.yourcompany.com.
Then call stored procedures to complete the OAuth exchange:
- Call the GetOAuthAuthorizationURL stored procedure. Set the AuthMode input to WEB and set the CallbackURL input to the redirect URI you specified in your application settings. If necessary, set the Permissions parameter to request custom permissions. The stored procedure returns the URL to the OAuth endpoint.
- Open the URL, log in, and authorize the application. You are redirected back to the callback URL.
- Call the GetOAuthAccessToken stored procedure. Set the AuthMode input to WEB. Set the Verifier input to the "code" parameter in the query string of the callback URL. If necessary, set the Permissions parameter to request custom permissions.
To connect to data, set the OAuthAccessToken connection property to the access token returned by the stored procedure. When the access token expires after ExpiresIn seconds, call the GetOAuthAccessToken stored procedure again to obtain a new access token.
Headless Machines
To configure the provider to use OAuth with a user account on a headless machine, you must authenticate on another device that has an internet browser.- Choose one of two options:
- Option 1: Obtain the OAuthVerifier value as described in "Obtain and Exchange a Verifier Code" below.
- Option 2: Install the provider on a machine with a browser and transfer the OAuth authentication values after you authenticate through the usual browser-based flow, as described in "Transfer OAuth Settings" below.
- Then configure the provider to automatically refresh the access token on the headless machine.
Option 1: Obtain and Exchange a Verifier Code
To obtain a verifier code, you must authenticate at the OAuth authorization URL.
Follow the steps below to authenticate from the machine with an internet browser and obtain the OAuthVerifier connection property.
- Create the Authorization URL by setting the following properties:
- InitiateOAuth: OFF.
- OAuthClientId (custom applications only): The client Id assigned when you registered your application.
- OAuthClientSecret (custom applications only): The client secret assigned when you registered your application.
- OAuthVersion: 2.0.
- Call the GetOAuthAuthorizationURL stored procedure with the CallbackURL input parameter set to the exact redirect URI you specified in your application. For Cloud instances, this is found under Authorization > OAuth 2.0 (3LO). For Data Center instances, this is found under General Configuration > Administration > Application Links > Your application > Edit.
- Open the returned URL in a browser. Log in and grant permissions to the provider. You are then redirected to the callback URL, which contains the verifier code.
- Save the value of the verifier code. You need to set this in the OAuthVerifier connection property.
Next, you must exchange the OAuth verifier code for OAuth refresh and access tokens. Set the following properties:
On the headless machine, set the following connection properties to obtain the OAuth authentication values.
- InitiateOAuth: REFRESH.
- OAuthVerifier: The verifier code.
- OAuthClientId (custom applications only): The client Id in your custom OAuth application settings.
- OAuthClientSecret (custom applications only): The client secret in the custom OAuth application settings.
- OAuthSettingsLocation: Set this to persist the encrypted OAuth authentication values to the specified location.
- InitiateOAuth: REFRESH.
After the OAuth settings file is generated, you must re-set the following properties to connect:
- InitiateOAuth: REFRESH.
- OAuthClientId (custom applications only): The client Id assigned when you registered your application.
- OAuthClientSecret (custom applications only): The client secret assigned when you registered your application.
- OAuthSettingsLocation: The location containing the encrypted OAuth authentication values. Make sure this location gives read and write permissions to the provider to enable the automatic refreshing of the access token.
- OAuthVersion: 2.0.
- URL: The URL to your Confluence endpoint. For Cloud instances, for example, https://yoursitename.atlassian.net. For Data Center instances, for example, https://confluence.yourcompany.com.
Option 2: Transfer OAuth Settings
Prior to connecting on a headless machine, you must install and create a connection with the provider on a device that supports an internet browser. Set the connection properties as described in "Desktop Applications" above.
After completing the instructions in "Desktop Applications", the resulting authentication values are encrypted and written to the location specified by OAuthSettingsLocation. The default filename is OAuthSettings.txt.
After you have successfully tested the connection, copy the OAuth settings file to your headless machine.
On the headless machine, set the following connection properties to connect to data:
- InitiateOAuth: REFRESH.
- OAuthClientId (custom applications only): The client Id assigned when you registered your application.
- OAuthClientSecret (custom applications only): The client secret assigned when you registered your application.
- OAuthSettingsLocation: The location of your OAuth settings file. Make sure this location gives read and write permissions to the provider to enable the automatic refreshing of the access token.
- CallbackURL (custom applications only): The callback URL in your application. For Cloud instances, navigate to Authorization > OAuth 2.0 (3LO). For Data Center instances, navigate to General Configuration > Administration > Application Links > Your application > Edit.
- InitiateOAuth: REFRESH.
- OAuthSettingsLocation: The location of your OAuth settings file. Make sure this location gives read and write permissions to the provider to enable the automatic refreshing of the access token.
- OAuthVersion: 2.0.
- URL: The URL to your Confluence endpoint. For Cloud instances, for example, https://yoursitename.atlassian.net. For Data Center instances, for example, https://confluence.yourcompany.com.
PAT Authentication
PATs are supported for Data Center instances running Confluence 7.9 or later.Acquire a Token
To generate a PAT, log in to your Atlassian account and select your profile picture at the top right of the screen, then select Profile > Personal Access Tokens > Create token.
Authenticate Using the Token
To authenticate using PAT, specify the following properties:
- AuthScheme: PAT.
- User: The user to authenticate with the Confluence instance.
- PAT: The PAT associated with the authenticated user.
- URL: The URL associated with your Confluence endpoint. For example, https://confluence.yourcompany.com.
Crowd
To authenticate via Crowd SSO:
- AuthScheme: Crowd
- User: The Crowd user account.
- Password: The password associated with the Crowd account.<
- SSOLoginURL: The login URL associated with the Crowd account. You can find the IDP URL by navigating to your application > SSO > SSO information > Identity provider single sign-on URL.
- SSOAppName: The name of the application in which SSO is enabled.
- SSOAppPassword: The password of the application in which SSO is enabled.
- SSOExchangeURL: The URL used used to exchange the SAML token for Confluence cookies. This URL may have the following formats:
- https://<authority of Confluence instance>/plugins/servlet/samlconsumer
- https://<authority of Confluence instance>/plugins/servlet/samlsso
Example connection string:
AuthScheme=Crowd;Url=https://yoursitename.atlassian.net;SSOLoginURL='https://<authority>/crowd/console/secure/saml/sso.action';User=crowdUserName;Password=crowdPassword;SSOExchangeUrl=https://<authority of Confluence instance>/plugins/servlet/samlconsumer;SSOAppName=CrowdAppName;SSOAppPassword=CrowdAppPassword;
Okta
To connect to Okta, set these properties:
- AuthScheme: Okta.
- User: The authenticating Okta user.
- Password: The password of the authenticating Okta user.
- SSOLoginURL: The SSO provider's login URL.
- SSOExchangeURL: The URL used used to exchange the SAML token for Confluence cookies. This URL may have the following formats:
- https://<authority of Confluence instance>/plugins/servlet/samlconsumer
- https://<authority of Confluence instance>/plugins/servlet/samlsso
If you are either using a trusted application or proxy that overrides the Okta client request OR configuring MFA, you must use combinations of SSOProperties to authenticate using Okta. Set any of the following, as applicable:
- APIToken: When authenticating a user via a trusted application or proxy that overrides the Okta client request context, set this to the API Token the customer created from the Okta organization.
- MFAType: If you have configured the MFA flow, set this to one of the following supported types: OktaVerify, Email, or SMS.
- MFAPassCode: If you have configured the MFA flow, set this to a valid passcode.
If you set this to empty or an invalid value, the provider issues a one-time password challenge to your device or email. After the passcode is received, reopen the connection where the retrieved one-time password value is set to the MFAPassCode connection property. - MFARememberDevice: True by default. Okta supports remembering devices when MFA is required. If remembering devices is allowed according to the configured authentication policies, the provider sends a device token to extend MFA authentication lifetime. If you do not want MFA to be remembered, set this variable to False.
Example connection string:
AuthScheme=Okta;Url=https://yoursitename.atlassian.net;SSOLoginURL='https://example.okta.com/home/appType/0bg4ivz6cJRZgCz5d6/46';User=oktaUserName;Password=oktaPassword;SSOExchangeUrl=https://<authority of Confluence instance>/plugins/servlet/samlconsumer;