How to fix OAuth Access Token mismatches between Confluence and Jira


Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

In Confluence and Jira, an 'Application Link' is a mechanism that enables these two Atlassian products to communicate and integrate seamlessly. Application Links establish a connection or linkage between Confluence and Jira instances. However, to access data from an external system, Confluence and Jira require an OAuth access token.

OAuth (Open Authorization) access tokens play a pivotal role in the OAuth protocol, widely employed for secure authorization and authentication in the realm of web applications and APIs. These tokens are utilised to grant restricted access to a user's resources or data without the need to expose their credentials, such as a password. OAuth access tokens allow other applications to access Confluence through an external web application or website, commonly referred to as the 'consumer.'

Confluence and Jira generate an OAuth access token when a user initially adds the Jira Issues Macro in Confluence. Users will receive a notification in the Webwork bell icon, located at the top right corner of the interface. This notification resembles the example below and is similar to what users receive when adding the Jira Issues Macro for the first time.

When we click on 'Authorize,' an OAuth call generates a callback URL from Jira, requesting permission. In this context, it's interesting to note the Application Name (Confluence) and Application Hostname (Localhost) since both Confluence and Jira are running locally.

Sometimes, when users migrate servers from one instance to another, they may encounter a mismatch in the application name and URL. This mismatch often originates from older database records.

In this knowledge base article, we will explore the database tables where this information is stored and provide guidance on how to resolve these discrepancies.

Diagnosis

Check the OAuth Consumer details in both applications. 

  • Run the following SQL statement in the Jira Database: 

    select * from oauthconsumer;
  • Run the following SQL statement to Confluence Database:

    select bandanavalue from bandana where bandanakey='com.atlassian.oauth.consumer.ConsumerService:host.__HOST_SERVICE__';



Solution

To fix the mismatch between application name and the application Host, use the following steps:

  1. Run below SQL for Jira in the Jira Database

    update oauthconsumer set consumername = '<CORRECT APPLICATION NAME>', description  = 'Atlassian Jira at <CURRENT JIRA URL' where id = '<ID>';
    commit;


  2. Run the below SQL for Confluence in the Confluence Database.
    (info) Here copy the BANDANA  value from the BANDANA table for bandanakey "com.atlassian.oauth.consumer.ConsumerService:host.__HOST_SERVICE__"  executed previously, and replace the description and name accordingly.

    update bandana set bandanavalue = '<properties>
      <property name="privateKey" value="<Private KEY>"/>
      <property name="name" value="<Actual Application Name>"/>
      <property name="description" value="Atlassian Confluence at <Actual Confluence URL>"/>
      <property name="signatureMethod" value="RSA_SHA1"/>
      <property name="publicKey" value="<Public Key>"/>
      <property name="key" value="<Value>"/>
    </properties>' where bandanakey='com.atlassian.oauth.consumer.ConsumerService:host.__HOST_SERVICE__';
  3. Upon updating the service name and URL in both the Confluence and Jira databases, please proceed to restart Confluence and Jira.
    This action will ensure that the application picks up the updated values from the database for seamless continuation of the subsequent processes.
  4. Recreate the app links.
    Following this, users will receive a new application access authorization request.
  5. Once they create the authorization token, they will begin receiving notifications, and the authorization access token will accurately display the correct service name and URL under their respective profiles.

Last modified on Oct 27, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.