mirror of
https://github.com/opencultureconsulting/orcli.git
synced 2025-04-13 00:00:49 +02:00
13 lines
368 B
Bash
13 lines
368 B
Bash
![]() |
# get CSRF token (introduced in OpenRefine 3.3)
|
||
|
function get_csrf {
|
||
|
if [[ "${OPENREFINE_CSRF}" == true ]]; then
|
||
|
local response
|
||
|
response=$(curl -fs "${OPENREFINE_URL}/command/core/get-csrf-token")
|
||
|
if ! [[ "${response}" == '{"token":"'* ]]; then
|
||
|
error "getting CSRF token failed!"
|
||
|
exit 1
|
||
|
fi
|
||
|
echo "?csrf_token=$(echo "$response" | cut -d \" -f 4)"
|
||
|
fi
|
||
|
}
|