Skip to content

Commit

Permalink
[SKIP-CI] auth-utils: Fix curl command
Browse files Browse the repository at this point in the history
  • Loading branch information
Akianonymus committed Aug 8, 2022
1 parent 6fa449e commit ffc3adb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion release/bash/gupload
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ cat "$TMPFILE.code"
return 1
fi
(rm -f "$TMPFILE.code"&)
response_check_refresh_token="$(_curl --compressed "$CURL_PROGRESS" -X POST \
response_check_refresh_token="$(curl --compressed "$CURL_PROGRESS" -X POST \
--data "code=$authorization_code&client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET&redirect_uri=$REDIRECT_URI%3A$server_port_check_refresh_token&grant_type=authorization_code&code_verifier=$code_challenge_check_refresh_token" "$TOKEN_URL")"||:
_clear_line 1 1>&2
refresh_token_value_check_refresh_token="$(printf "%s\n" "$response_check_refresh_token"|_json_value refresh_token 1 1)"||{ printf "%s\n" "Error: Cannot fetch refresh token, make sure the authorization code was correct."&&printf "%s\n" "$response_check_refresh_token"&&return 1;}
Expand Down
2 changes: 1 addition & 1 deletion release/sh/gupload
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ cat "$TMPFILE.code"
return 1
fi
(rm -f "$TMPFILE.code"&)
response_check_refresh_token="$(_curl --compressed "$CURL_PROGRESS" -X POST \
response_check_refresh_token="$(curl --compressed "$CURL_PROGRESS" -X POST \
--data "code=$authorization_code&client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET&redirect_uri=$REDIRECT_URI%3A$server_port_check_refresh_token&grant_type=authorization_code&code_verifier=$code_challenge_check_refresh_token" "$TOKEN_URL")"||:
_clear_line 1 1>&2
refresh_token_value_check_refresh_token="$(printf "%s\n" "$response_check_refresh_token"|_json_value refresh_token 1 1)"||{ printf "%s\n" "Error: Cannot fetch refresh token, make sure the authorization code was correct."&&printf "%s\n" "$response_check_refresh_token"&&return 1;}
Expand Down
4 changes: 2 additions & 2 deletions src/common/auth-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -398,12 +398,12 @@ EOF
(rm -f "${TMPFILE}.code" &)

# https://developers.google.com/identity/protocols/oauth2/native-app#handlingresponse
response_check_refresh_token="$(_curl --compressed "${CURL_PROGRESS}" -X POST \
response_check_refresh_token="$(curl --compressed "${CURL_PROGRESS}" -X POST \
--data "code=${authorization_code}&client_id=${CLIENT_ID}&client_secret=${CLIENT_SECRET}&redirect_uri=${REDIRECT_URI}%3A${server_port_check_refresh_token}&grant_type=authorization_code&code_verifier=${code_challenge_check_refresh_token}" "${TOKEN_URL}")" || :
_clear_line 1 1>&2

refresh_token_value_check_refresh_token="$(printf "%s\n" "${response_check_refresh_token}" | _json_value refresh_token 1 1)" ||
{ printf "%s\n" "Error: Cannot fetch refresh token, make sure the authorization code was correct." && printf "%s\n" "${response_check_refresh_token}" && return 1; }
{ printf "%s\n" "Error: Code was not fetched properly , here is some info that maybe helpful.." && printf "%s\n" "${response_check_refresh_token}" && return 1; }

_set_value direct REFRESH_TOKEN "${refresh_token_value_check_refresh_token}"
{ _check_access_token "${account_name_check_refresh_token}" skip_check "${response_check_refresh_token}" &&
Expand Down

0 comments on commit ffc3adb

Please # to comment.