mirror of
https://github.com/pia-foss/manual-connections.git
synced 2025-02-05 14:08:29 +00:00
When token service fails, display the error
When https://www.privateinternetaccess.com/api/client/v2/token fails, such as with an "504 Gateway Time-out" error, display that error so the user knows what happened.
This commit is contained in:
parent
e37693326d
commit
0cf65d3e8b
12
get_token.sh
12
get_token.sh
|
@ -69,10 +69,18 @@ fi
|
||||||
|
|
||||||
echo -n "Checking login credentials..."
|
echo -n "Checking login credentials..."
|
||||||
|
|
||||||
generateTokenResponse=$(curl -s --location --request POST \
|
generateTokenResponse=$(curl --fail-with-body -s --location --request POST \
|
||||||
'https://www.privateinternetaccess.com/api/client/v2/token' \
|
'https://www.privateinternetaccess.com/api/client/v2/token' \
|
||||||
--form "username=$PIA_USER" \
|
--form "username=$PIA_USER" \
|
||||||
--form "password=$PIA_PASS" )
|
--form "password=$PIA_PASS" ) || {
|
||||||
|
echo
|
||||||
|
echo -e "${red}Could not authenticate with the login credentials provided!${nc}"
|
||||||
|
echo "Error response:"
|
||||||
|
echo $generateTokenResponse
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if [ "$(echo "$generateTokenResponse" | jq -r '.token')" == "" ]; then
|
if [ "$(echo "$generateTokenResponse" | jq -r '.token')" == "" ]; then
|
||||||
echo
|
echo
|
||||||
|
|
Loading…
Reference in New Issue
Block a user