I'm brand new to the swagger-gen Jira REST API for Cloud.
I have the code generated but cannot authenticate using Basic, which is expected because it's deprecated. I have my API token generated but cannot figure out how to use it.
The two posts that show how to use the API, they use Basic auth.
(https://community.atlassian.com/t5/Jira-articles/Generating-a-REST-client-for-Jira-Cloud/ba-p/1307133)
and diving into the code, Jersey then sends a BASIC authentication which gets rejected.
Looking at the generated ApiClient.java it has two methods defined
authentications = new HashMap<String, Authentication>();
authentications.put("OAuth2", new OAuth());
authentications.put("basicAuth", new HttpBasicAuth());
But there's a third way in the code - ApiKeyAuth.java
and I think that's what I now need to use.
How do I use it?
Do I regenerate the code with some extra options to swagger or do I edit Atlassian's JSON:
I see this section in the JSON for each call, is it now wrong?
"security": [
{
"basicAuth": []
},
{
"OAuth2": [
"read:jira-work"
]
},
I hope that all makes sense, it's been an afternoon of rabbit holes. But if I'm right the docs need an update because they keep referring to Basic auth.
many thanks