Hi, I am new to Jira and new to OAuth2 so.... yeah. ;-)
I am trying to implement OAuth2 for Jira in a DevOps extension (authorization code flow).
The devops extension FE runs inside an IFrame in the DevOps site (not sure if that is relevant). I am using '@badgateway/oauth2-client' as a client JS/TS library.
For testing I am running Jira in a Docker image (no https, only http) locally as well as the extension code locally in VScode.
I have created an application link in Jira with the callback url I created to pickup the authorization code and fetch the access token from jira. I copied the resulting client id and secret for use in the extension.
When I call the jira /authorize endpoint with the necessary query string params I get an error from the Jira server (tomcat) on the (plugin) consent page.
HTTP Status 412 – Precondition Failed
Type Status Report
Message Invalid 'redirect_uri' URL parameter provided
Description One or more conditions given in the request header fields evaluated to false when tested on the server.
Apache Tomcat/9.0.83
This is the url (localhost:8080=docker):
http://localhost:8080/plugins/servlet/oauth2/consent
?client_id=<app link client id>
&redirect_uri=https://dev.azure.com/<org>/<project>/_apps/hub/<extension>.<location>
&response_type=code
&scope=WRITE
&state=<my state>
&code_challenge_method=S256
&code_challenge=<generated challenge code>
No matter what I try with the redirect_url, I keep getting errors.
There is probably something obvious I am doing wrong, but I am not seeing it.
Thanks in advance.