Jira server (onPremise) and Tempo Accounts (OnPremise) - API Access

Admin Gabriel Maret September 8, 2023

Hello,

We have a Jira Server On-Premise with a Tempo Account for Jira integration.

I would like to manage both of them with API Request made from Powershell. 

I created a Personnal Access Token (PAT) on Jira server and all of the Jira Server Requests are Fine : 

$JiraOnPremHeaders = @{
    Authorization = "Bearer  $JiraOnPremToken"
    Accept = "application/json"
}

Invoke-RestMEthod -Method Get -Uri "$($JiraOnPremServer)/rest/api/2/project" -Headers $JiraOnPremHeaders
This is not working the same with Tempo Accounts. Seems that on the API documentation (REST API Accounts (tempo.io)) I should use basicAuth. 
It will not work as we are using Microsoft as an ISP and the MFA...
If I change the auth method to basic, see below, it's not working : 
$JiraTempoCredentials = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("$($JiraOnPremUser):$($JiraOnPremToken)"))
$JiraTempoHeaders = @{
    Authorization = "Basic $JiraTempoCredentials"
    Accept = "application/json"
}

Invoke-RestMEthod -Method Get -Uri "$($JiraOnPremServer)/rest/tempo-accounts/1/account" -Headers $JiraTempoHeaders
(JiraOnPremUser is the e-mail address of the user, JiraOnPremToken is the PAT of the user)
Is there a way to authenticate against the Tempo For Jira API with a token and not a "user:password" ?

Many thanks
Best regards
Gabriel

1 answer

1 accepted

0 votes
Answer accepted
Admin Gabriel Maret September 8, 2023

Finally it's working this way :

$JiraOnPremHeaders = @{
    Authorization = "Bearer $JiraOnPremToken"
    Accept = "application/json"
}

$JiraAccounts = Invoke-RestMEthod -Method Get -Uri "$($JiraOnPremServer)/rest/tempo-accounts/1/account" -Headers $JiraOnPremHeaders
So finally I'm using the "Bearer" auth.
Best regards

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events