Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to run authenticate in JiraPS after 2.12.5 Update

Aaron Jones December 23, 2019

Hello,

 

I'm seeing an issue running scripts after the 27th of November. When I attempt to run a script or authenticate it gives the following:

PS C:\Windows\system32> New-JiraSession -Credential $cred
DEBUG: [Get-JiraConfigServer] ParameterSetName: __AllParameterSets
DEBUG: [Get-JiraConfigServer] PSBoundParameters:
Key Value
--- -----
ErrorAction Stop

 

DEBUG: [New-JiraSession] ParameterSetName: __AllParameterSets
DEBUG: [New-JiraSession] PSBoundParameters:
Key Value
--- -----
Credential System.Management.Automation.PSCredential

 

DEBUG: [Invoke-JiraMethod] ParameterSetName: __AllParameterSets
DEBUG: [Invoke-JiraMethod] PSBoundParameters:
Key Value
--- -----
Credential System.Management.Automation.PSCredential
Method Get
Headers {}
URI https://mycompany.atlassian.net/rest/api/2/myself
StoreSession True

 

Resolve-DefaultParameterValue : Cannot bind argument to parameter 'Reference' because it is null.
At C:\Program Files\WindowsPowerShell\Modules\JiraPS\2.12.5\JiraPS.psm1:3215 char:78
+ ... ultParameterValue -Reference $global:PSDefaultParameterValues -Comman ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Resolve-DefaultParameterValue], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Resolve-DefaultParameterValue

Cannot index into a null array.
At C:\Program Files\WindowsPowerShell\Modules\JiraPS\2.12.5\JiraPS.psm1:3222 char:9
+ $_headers = Join-Hashtable -Hashtable $script:DefaultHeaders, ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray

You cannot call a method on a null-valued expression.
At C:\Program Files\WindowsPowerShell\Modules\JiraPS\2.12.5\JiraPS.psm1:3266 char:13
+ if ($_headers.ContainsKey("Content-Type")) {
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

DEBUG: [Test-ServerResponse] Investigating $InputObject.Headers['X-Seraph-LoginReason']
DEBUG: [New-JiraSession] Adding session result to existing module PrivateData

PS C:\Windows\system32>

 

I've got the latest version of Powershell and my JiraPS module is 2.12.5 and am at the limit of my Powershell knowledge.

1 answer

1 accepted

1 vote
Answer accepted
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 2, 2020

Hi Aaron,
I understand that you're using the JiraPS powershell module to try to connect to your Jira Cloud site, but this is not working as expected for authorization calls.  I found a related thread to yours over on https://github.com/AtlassianPS/JiraPS/issues/350

It seems that at least one other user seems to have gotten the same kind of error message.  In that thread it seems they were able to resolve this by adjusting the credentials used to connect.  Instead of using the cleartext password to do the authentication, they generated an API token and used that in a specific way to complete the authentication.  More details on the steps needed can be found in Basic auth for REST APIs .

This change goes back to our Deprecation notice - Basic authentication with passwords and cookie-based authentication.  In short, you can't use cleartext passwords for REST API calls to Jira Cloud sites anymore.  Perhaps you were using this in the past successfully.  But you should still be able to create a token to complete basic authentication, you just need to follow the steps in that guide to make sure that you have encoded it in a format of

user@example.com:API_Token

into a base64 string and then pass that encoded string in an authorization header.

I hope this helps.

Andy

Aaron Jones January 2, 2020

Andy, thanks! That did indeed solve the issue. 

Like Andy Heinzer likes this

Suggest an answer

Log in or Sign up to answer