Open childsc opened 2 years ago
tldr; try New-JiraSession -Headers @{Authorization="Bearer <PAT Token>"} -Credential $([System.Management.Automation.PSCredential]::Empty)
I was having a similar issue authenticating to a Jira Server instance. All the documentation is for Jira Cloud.
I was able to find an explanation of the difference when using a PAT here and I confirmed with curl.
So, I took a dive into New-JiraSession and then Invoke-JiraMethod.
Apparently you can use empty credentials
$creds = [System.Management.Automation.PSCredential]::Empty
and manually create the authorization header.
New-JiraSession -Headers @{Authorization="Bearer <PAT Token>"} -Credential $creds
This should actually by Please update the Documentation around PAT. Many thanks @Alreanaes
Using JiraPS 2.14.6 trying to connect to Jira Server and on
New-JiraSession -Headers @{Authorization="Bearer <PAT Token>"} -Credential $([System.Management.Automation.PSCredential]::Empty
I get an error:
Invoke-JiraMethod : token contains an invalid number of segments
Description
We will be looking to disable the basic Authentication against Jira in the next few months. However we are not able to create new sessions when using the PAT. According to the documentation we are supposed to use the user's email address and the PAT to create a session. However, this does not appear to be working. https://atlassianps.org/docs/JiraPS/about/authentication.html#api-token
Steps To Reproduce
$password = ConvertTo-SecureString '<TOKEN>' -AsPlainText -Force $creds = New-Object System.Management.Automation.PSCredential ('users@emailAddress.com', $password) New-JiraSession -Credential $creds
Expected behavior
Expected to see the following (as we see with basic Auth):
Username WebSession
test Microsoft.PowerShell.Commands.WebRequestSession
Your Environment