Hey everyone,
I’m trying to get my head around using the JIRA API to pull data from our company’s setup. The login process is a bit of a maze:
- Go to our company’s Atlassian page
- Land on the login screen
- Put in my work email
- Get sent to Microsoft to prove it’s me
- Type in my Azure AD password
- Pick how to double-check it’s really me (I usually go for a text to my phone)
- Finally in!
I’m scratching my head over a couple of things:
- How do I turn this whole song and dance into C# code?
- Will my app need to do the phone verification every single time?
I’m aiming to set this up as an Azure function with a timer trigger to grab JIRA data regularly. But I’m stuck at the very first hurdle - getting past the login!
Any ideas how to crack this? Thanks in advance!
hey creativepainter33, try OAuth2 lib for c# to sort out the JIRA login. once token is set, no need for repeated verif - just refresh. hope that helps!
For your JIRA API authentication challenge, consider implementing a service account approach. This method bypasses the need for regular user login processes, including multi-factor authentication.
Request a dedicated API token or service account from your IT department. This account should have the necessary permissions to access the required JIRA data. Once set up, you can use this token in your C# code to authenticate API requests.
In your Azure function, store the API token securely using Azure Key Vault. This ensures your credentials remain protected. Then, use the token to authenticate your requests to the JIRA API.
This solution eliminates the need for complex user authentication flows and should work well for automated, scheduled data retrieval tasks.
I’ve been down this rabbit hole before, and let me tell you, it’s a doozy. What worked for me was using the JIRA Cloud REST API with a Personal Access Token (PAT). It’s way simpler than dealing with the full OAuth dance.
First, generate a PAT in your JIRA account settings. Then, in your C# code, you can use this token in the Authorization header of your HTTP requests. Something like:
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(“Bearer”, yourPAT);
This approach sidesteps the whole multi-factor auth issue. Your Azure function can use this token for all requests without needing to re-authenticate each time.
Just remember to store that PAT securely in Azure Key Vault. And set up a process to rotate it regularly for good security hygiene. Trust me, this’ll save you a ton of headaches down the line.