From 15b6bef24ef1f0c6dbd5d8cb32c945ecef383350 Mon Sep 17 00:00:00 2001 From: Akianonymus Date: Mon, 13 Jul 2020 22:04:49 +0530 Subject: [PATCH] [BUGFIX] Fix REFRESH_TOKEN not updating in config after first run Resolve #86 --- upload.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/upload.sh b/upload.sh index ade64ab..c22cca8 100755 --- a/upload.sh +++ b/upload.sh @@ -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" @@ -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