Client must be authenticated to access this resource.","status-code":401
Invoke-RestMethod : The remote server returned an error: (401) Unauthorized.
At E:\Scripts\XXXX.ps1:37 char:1
+ Invoke-RestMethod -UseBasicParsing -Method Post -Uri "https://$hostna ...
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
VERBOSE: POST https://xxx.atlassian.net/rest/backup/1/export/runbackup with -1-byte payload
Comments (10)
-
-
same here, using curl:
> POST /rest/backup/1/export/runbackup HTTP/1.1 > Host: xxx.atlassian.net > Authorization: Basic xxx > User-Agent: curl/7.52.1 > Accept: application/json > Content-Type: application/json > Content-Length: 48 > * Connection state changed (MAX_CONCURRENT_STREAMS updated)! * We are completely uploaded and fine < HTTP/2 401 < server: AtlassianProxy/1.13.6.2 < www-authenticate: OAuth realm="https%3A%2F%2Fxxx.atlassian.net" < content-type: application/json;charset=UTF-8 < strict-transport-security: max-age=315360000; includeSubDomains; preload < date: Wed, 15 May 2019 12:45:36 GMT < atl-traceid: xxx < x-aaccountid: xxx < x-arequestid: xxx < x-xss-protection: 1; mode=block < timing-allow-origin: * < x-content-type-options: nosniff < set-cookie: atlassian.xsrf.token=xxx; Path=/; Secure <
no message at all, just 401
-
Hello All,
Try to change authentication method, Instead of using cookies and plain username and password, try using API Token. It works for me.
-
A primary use case for API tokens is to allow scripts to access REST APIs for Atlassian Cloud applications using HTTP basic authentication.
it means that i can use issued api-token instead of a password in HTTP basic auth, right?
curl -vv --user xxx@yyy.zz:%HERE_GOES_API_TOKEN% -H "Accept: application/json" -H "Content-Type: application/json" https://yyy.atlassian.net/rest/backup/1/export/runbackup --data-binary '{"cbAttachments":"true", "exportToCloud":"true"}'
it gives me same old 401:
> POST /rest/backup/1/export/runbackup HTTP/1.1 > Host: yyy.atlassian.net > Authorization: Basic xxx > User-Agent: curl/7.52.1 > Accept: application/json > Content-Type: application/json > Content-Length: 48 > * We are completely uploaded and fine * Connection state changed (MAX_CONCURRENT_STREAMS updated)! < HTTP/2 401 < server: AtlassianProxy/1.15.8.1 < www-authenticate: OAuth realm="https%3A%2F%2Fyyy.atlassian.net" < content-type: application/json;charset=UTF-8 < strict-transport-security: max-age=315360000; includeSubDomains; preload < date: Wed, 22 May 2019 10:39:58 GMT < atl-traceid: 551fde6e17a340d3 < x-aaccountid: 5b76bd26bc4aa8061ca71b4d < x-arequestid: f6f672f6-b7a9-4217-a0b9-e4cec4c6a658 < x-xss-protection: 1; mode=block < timing-allow-origin: * < x-content-type-options: nosniff < set-cookie: atlassian.xsrf.token=xxx; Path=/; Secure <
may it means that my account is not able to request backups through API? what kind of rights account needs to have to perform backup API requests?
-
You need admin access for sure for backup and restore process.
-
I have the same issue. I can take a backup via the backup manager interface, so I think I have enough rights to launch and retrieve a backup via the rest api?
-
Sorry, a typo error in my email. Now it’s ok
./backup-jira-api-token.sh
starting the script: 23-05-2019
Response: {"error":"Backup frequency is limited. You cannot make another backup right now. Approximate time until next allowed backup: 44h 46m"}
BACKUP FAILED!! Message returned: {"error":"Backup frequency is limited. You cannot make another backup right now. Approximate time until next allowed backup: 44h 46m"}
-
Yes, try and see you should be able to take backup
-
Yeah, that works fine. Just try again after 45 hours and your backup will be done successfully
-
- changed status to resolved
Cookie authentication has been deprecated as announced long time ago and it will gradually stop working for all the customers/instances (it already started).
For details see: https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-basic-auth-and-cookie-based-auth/
- Log in to comment
Exactly Same Issue have been occurring for me as well.
Any Idea how it can be tackled?