2021-03-04 19:17:30 +00:00
|
|
|
BASEPATH=$(dirname $(realpath $0))
|
2021-03-13 13:50:48 +00:00
|
|
|
. $BASEPATH/.env
|
2023-01-12 12:05:37 +00:00
|
|
|
|
|
|
|
if [ $TOKENID ] && [ -z $SIPUSER ]
|
|
|
|
then SIPUSER=$TOKENID
|
|
|
|
fi
|
|
|
|
if [ $TOKEN ] && [ -z $SIPPWD ]
|
|
|
|
then SIPPWD=$TOKEN
|
|
|
|
fi
|
|
|
|
|
2022-03-22 09:53:26 +00:00
|
|
|
AUTH_TOKEN=$(curl -o /dev/null -s -w "%{http_code}\n" --request GET --header 'Accept: application/json' --user $SIPUSER:$SIPPWD https://api.sipgate.com/v2/authorization/userinfo -s)
|
|
|
|
if [ $AUTH_TOKEN = "200" ];
|
2021-03-04 17:29:32 +00:00
|
|
|
then
|
2022-03-22 09:53:26 +00:00
|
|
|
echo "Login OK"
|
2021-03-04 17:29:32 +00:00
|
|
|
else
|
2022-03-22 09:53:26 +00:00
|
|
|
echo "Login failed"
|
2021-03-04 17:29:32 +00:00
|
|
|
fi
|