Skip to content

Commit

Permalink
Merge pull request #89 from Akianonymus/fix
Browse files Browse the repository at this point in the history
[BUGFIX] Fix REFRESH_TOKEN not updating in config after first run
  • Loading branch information
labbots committed Jul 13, 2020
2 parents d4c75f6 + 15b6bef commit dac1a5c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -798,8 +798,7 @@ _check_credentials() {
printf "%b" "If you have a refresh token generated, then type the token, else leave blank and press return key..\n\nRefresh Token: "
read -r REFRESH_TOKEN && REFRESH_TOKEN="${REFRESH_TOKEN//[[:space:]]/}"
if [[ -n ${REFRESH_TOKEN} ]]; then
_get_token_and_update &&
_update_config REFRESH_TOKEN "${REFRESH_TOKEN}" "${CONFIG}"
_get_token_and_update && _update_config REFRESH_TOKEN "${REFRESH_TOKEN}" "${CONFIG}"
else
printf "\nVisit the below URL, tap on allow and then enter the code obtained:\n"
URL="https://accounts.google.com/o/oauth2/auth?client_id=${CLIENT_ID}&redirect_uri=${REDIRECT_URI}&scope=${SCOPE}&response_type=code&prompt=consent"
Expand All @@ -810,7 +809,7 @@ _check_credentials() {
--data "code=${CODE}&client_id=${CLIENT_ID}&client_secret=${CLIENT_SECRET}&redirect_uri=${REDIRECT_URI}&grant_type=authorization_code" "${TOKEN_URL}")" || :

REFRESH_TOKEN="$(_json_value refresh_token 1 1 <<< "${RESPONSE}")"
_get_token_and_update "${RESPONSE}"
_get_token_and_update "${RESPONSE}" && _update_config REFRESH_TOKEN "${REFRESH_TOKEN}" "${CONFIG}"
else
printf "\n"
_print_center "normal" "No code provided, run the script and try again" " " 1>&2
Expand Down

0 comments on commit dac1a5c

Please sign in to comment.