Problem
When trying to establish the OAuth link between Jira Align and Jira, the applications aren't able to authenticate to each other.
After clicking the "Request Jira for access" button in the Jira Connector window, you receive the following error:
Welcome to JIRA
The request token cannot be authorized at this time. Try again later and if you continue to receive this error, contact the site administrator.
You will also see the following in the address bar of your browser:
https://<jira-URL>/plugins/servlet/oauth/authorize?oauth_problem=signature_invalid&oauth_signature=...
Diagnosis
Environment
- Jira Align and Jira are connected together using Application Links
- The authentication method used is OAuth
Cause
The Application URL on the Jira side of the link does not match the URL that Jira Align is reporting. This can be caused by one of the following scenarios:
- Check to make sure that the Consumer Key does not have any spaces in the name and matches exactly in both Jira and Jira Align.
- Check to make sure the OAuth Public Key matches exactly in both Jira and Jira Align.
- The Jira Base URL configured in the Jira Align Connector is set to something other than the Application URL defined on the link.
- The oauth_signature_base_string is calculated using the Application URL so if each side is configured with a different URL, the strings will not match.
- An example of this scenario is when the base Jira URL and Jira API URL are two different Fully Qualified Domain Names (FQDNs).
- A reverse proxy or port forwarding is configured, and the "Host" header is reporting the wrong host name or port.
- If you are using NGINX as the reverse proxy and using the
proxy_cache directive.
- The useBodyEncodingForURI tomcat parameter in the
<jira-install>/conf/server.xml is set to true.
In any of these scenarios, the affected applications will usually display other problems as well.
Resolution
Base URL
Applicable to scenario 3.
- Ensure the Base URL is correct for each application.
Application URL
Applicable to scenario 3.
-
The Application URL should match the Base URL of the other application unless you're bypassing a reverse proxy.
-
If the Application URL does not match the Base URL (and you're not bypassing a reverse proxy) then delete and recreate the Application Link.
Reverse Proxy
Applicable to scenario 4.
NGINX Reverse Proxy with proxy_cache directive
Applicable to scenario 4.
NGINX caching rewrites HEAD requests to GET requests by default which will interfere with application link communication between Atlassian products.
Tomcat (Jira)
Applicable to scenario 3.
To break down this scenario a bit further:
- The Jira side is creating the oauth_signature_base_string using the hostname that is defined in the Tomcat server.xml file.
- proxyName="jira.domain.xyz"
- The Jira Align side is creating the oauth_signature_base_string using the API URL in the connector configuration.
- The two oauth_signature_base_strings will not match and the OAuth connection will fail.
Creating a second connector: