We were using this script to make BACKUP from linux, but about 1 month ago it fails with these error:
{"message":"Client must be authenticated to access this resource.","status-code":401}
(PART OF SCRIPT)
COOKIE_FILE_LOCATION=jiracookie
curl --silent --cookie-jar $COOKIE_FILE_LOCATION -X POST "https://${INSTANCE}/rest/auth/1/session" -d "{\"username\": \"$USERNAME\", \"password\": \"$PASSWORD\"}" -H 'Content-Type: application/json' --output /dev/null
BKPMSG=$(curl -s --cookie $COOKIE_FILE_LOCATION -H "Accept: application/json" -H "Content-Type: application/json" https://${INSTANCE}/rest/backup/1/export/runbackup --data-binary '{"cbAttachments":"true"}' )
Can you help me?
Hi @Marcelo Riveiro ,
Authentication with username and password is deprecated. You'll have to create and use API tokens
Deprecation notice - Basic authentication with passwords and cookie-based authentication
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I changed my way to call API and now i am using token instead of password. But still i am getting 401 issue "Client must be authenticated to access this resource".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes same here I am doing the same but still not able to call the API.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Sohan Agate You might need to supply a Base64 encoded authorisation.
Have you seen section 3 under 'Supplying Basic Auth Headers':
I've used a Base64 encoder https://www.base64encode.org/
for encoding my API token with my email address, for the purpose of adding it in the Authorization header of web requests within my automations.
The method to follow is that you put '[emailaddress]:[API TOKEN]'
for example the Base65 encoder input would be:
email1@example.com:12345ABcDeFG6
And it will spit out the Base64 code:
ZW1haWwxQGV4YW1wbGUuY29tOjEyMzQ1QUJjRGVGRzY=
With this, follow the steps here:
For this to work in automation, my Base64 encoded API token was put into a variable called {{APIToken}}, then put into the header as such:
Note that the Key is 'Authorization', and the value must contain the word "Basic" with a space before your Base64 encoded token.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try like this:
1) encode the string
"username:password"
with Base64
2) add the header
"Authorization: Basic <encoded string>"
to your cUrl command
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you tried loggin to Jira on the browser with the second account, using exactly the same username and password you're using on cUrl?
Also consider that in case you change the password you must regenerate the API token.
Thomas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Also experiencing this issue - even though i'm using a token.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just like what @Chintan S Soni said, I found the same problem when I call API by using api token without password. Please do me a favor!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, we are using Tokens and Crowd to authenticate Username and password, basically semi SSO sign in, and we are getting this same error message when we try to project a Big Picture schedule Gadget on a Confluence page!? Any ideas on how to fix this would be greatly appreciated!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Same issue here!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This way it is working
BKPMSG=$(curl -s -u ${USERNAME}:${API_TOKEN} -H "Accept: application/json" -H "Content-Type: application/json" --data-binary '{"cbAttachments":"true"}' -X POST https://${INSTANCE}/rest/backup/1/export/runbackup )
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.