I need to check if the token is valid every time I run the script. In case it is valid, but skip the procedure for generating a new token. Is it possible to implement this by means of api?
I receive a token through curl
export SYS_TOKEN=curl --silent -i --cacert "$OS_CACERT" \
-X POST $OS_AUTH_URL/v3/auth/tokens -d '{"auth":{"identity":\
{"methods":["password"],"password":{"user":{"name": "'$USERNAME'", "domain":\
{"name": "default"}, "password": "'$PASSWORD'"}}}}}' \
-H 'Content-type: application/json' | \
awk -F ':' '/^X-Subject-Token/ {print $2}' | sed -e 's/\r$//'