Skip to content

Commit dac1a5c

Browse files
authored
Merge pull request #89 from Akianonymus/fix
[BUGFIX] Fix REFRESH_TOKEN not updating in config after first run
2 parents d4c75f6 + 15b6bef commit dac1a5c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

upload.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -798,8 +798,7 @@ _check_credentials() {
798798
printf "%b" "If you have a refresh token generated, then type the token, else leave blank and press return key..\n\nRefresh Token: "
799799
read -r REFRESH_TOKEN && REFRESH_TOKEN="${REFRESH_TOKEN//[[:space:]]/}"
800800
if [[ -n ${REFRESH_TOKEN} ]]; then
801-
_get_token_and_update &&
802-
_update_config REFRESH_TOKEN "${REFRESH_TOKEN}" "${CONFIG}"
801+
_get_token_and_update && _update_config REFRESH_TOKEN "${REFRESH_TOKEN}" "${CONFIG}"
803802
else
804803
printf "\nVisit the below URL, tap on allow and then enter the code obtained:\n"
805804
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() {
810809
--data "code=${CODE}&client_id=${CLIENT_ID}&client_secret=${CLIENT_SECRET}&redirect_uri=${REDIRECT_URI}&grant_type=authorization_code" "${TOKEN_URL}")" || :
811810

812811
REFRESH_TOKEN="$(_json_value refresh_token 1 1 <<< "${RESPONSE}")"
813-
_get_token_and_update "${RESPONSE}"
812+
_get_token_and_update "${RESPONSE}" && _update_config REFRESH_TOKEN "${REFRESH_TOKEN}" "${CONFIG}"
814813
else
815814
printf "\n"
816815
_print_center "normal" "No code provided, run the script and try again" " " 1>&2

0 commit comments

Comments
 (0)