Implement logging out of session.

This commit is contained in:
Kavin 2022-07-20 20:16:48 +05:30
parent 805270dd00
commit 12c4890587
No known key found for this signature in database
GPG key ID: 49451E4482CC5BCD
3 changed files with 35 additions and 0 deletions

View file

@ -67,6 +67,19 @@ if [[ -z "$AUTH_TOKEN" || $AUTH_TOKEN == "null" ]]; then
exit 1
fi
# Logout Session
curl ${CURLOPTS[@]} $HOST/logout -X POST -H "Authorization: Bearer $AUTH_TOKEN" || exit 1
# Login Account
curl ${CURLOPTS[@]} $HOST/login -X POST -H "Content-Type: application/json" -d $AUTH_REQ || exit 1
AUTH_TOKEN=$(curl -s -o - -f $HOST/login -X POST -H "Content-Type: application/json" -d $AUTH_REQ | jq -r .token)
if [[ -z "$AUTH_TOKEN" || $AUTH_TOKEN == "null" ]]; then
echo "Failed to get auth token"
exit 1
fi
# Check Subscription Status
curl ${CURLOPTS[@]} $HOST/subscribed -G --data-urlencode "channelId=UCsXVk37bltHxD1rDPwtNM8Q" -H "Authorization: $AUTH_TOKEN" || exit 1