10 lines
544 B
Bash
Executable file
10 lines
544 B
Bash
Executable file
BASEPATH=$(dirname $(realpath $0))
|
|
. $BASEPATH/login_credentials.sh
|
|
AUTH_TOKEN=$(echo $(curl --request POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --data-urlencode client_id=sipgate-app-web --data-urlencode grant_type=password --data-urlencode username=$SIPUSER --data-urlencode password=$SIPPWD https://api.sipgate.com/login/sipgate-apps/protocol/openid-connect/token -s | jq '.access_token') | sed 's/\"//g')
|
|
if [ -z "$AUTH_TOKEN" ];
|
|
then
|
|
echo "Login failed"
|
|
else
|
|
echo "Logged in"
|
|
fi
|