From 1c2cd191b4e67ef6a76262ab77f60303cc6b9c31 Mon Sep 17 00:00:00 2001 From: Dominika Date: Sat, 19 Sep 2020 20:49:44 +0200 Subject: [PATCH] fixups in common.sh --- code/common.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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)