Describe the bug
The script Extension-Attribute-Update-Encrypted-Script-Parameters-Bearer-Token.sh gets a bearer token and tests it and invalidates it, but when the API data is built the script uses User:Pass to get information.
To Reproduce
Turn off Basic Authentication for Classic API and this script breaks. The EA never gets updated.
Expected behavior
I expected the EA to be updated.
Code/log output
LINE 78:
apiRead=$( curl -H "Accept: text/xml" -sf --header "Authorization: Bearer ${apiBearerToken}" "${apiURL}"/JSSResource/computers/udid/"${computerUDID}"/subset/extension_attributes | xmllint --format - | grep -A3 "${eaName}" | awk -F'>|<' '/value/{print $3}' | tail -n 1 )
LINE 258:
apiPost=$(curl -H "Content-Type: text/xml" -sfu "${apiUsername}":"${apiPassword}" "${apiURL}"/JSSResource/computers/udid/"${computerUDID}" -d "${apiData}" -X PUT)
ERROR:
Script result: -:1: parser error : Document is empty
^
-:1: parser error : Document is empty
^
Version 1.4; apiBearerTokenCheck: 200; Beta Testing Program Status changed to None; apiBearerTokenCheck: 200; Bearer Token still valid; invalidate; Bearer Token invalidated; End-of-line.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
- OS version 13.6.6
- Script version 1.4
Additional context
Add any other context about the problem here.