diff --git a/code/common.sh b/code/common.sh index 5bd0b17..d7d1e51 100644 --- a/code/common.sh +++ b/code/common.sh @@ -7,7 +7,15 @@ function get_auth_string() { exit 0 fi - echo "Authorization: Bearer $(cat secret/authToken)" + echo "Authorization: Bearer $(cat secret/authTokens.dat | grep "${cookies[sh_session]}:" | sed -s "s/${cookies[sh_session]}://")" +} + +function get_refresh_token() { + if ! session_verify ${cookies[sh_session]}; then + exit 0 + fi + + echo "$(cat secret/refreshTokens.dat | grep "${cookies[sh_session]}:" | sed -s "s/${cookies[sh_session]}://")" } # check_if_user_exists(file)