tangled
alpha
login
or
join now
zio.sh
/
atfile
37
fork
atom
๐ฆโ๐ฆ Store and retrieve files on the Atmosphere
37
fork
atom
overview
issues
3
pulls
pipelines
add JWT refreshing
ducky.ws
1 month ago
b9c2d5ec
dc03ef71
1/1
build.yaml
success
9s
+12
-13
2 changed files
expand all
collapse all
unified
split
src
commands
auth.sh
lexi
com_atproto.sh
+11
-12
src/commands/auth.sh
···
76
76
77
77
# TODO: Handle accessJwt expiry
78
78
if [[ -n "$error" ]]; then
79
79
-
#if [[ $error == "[InvalidToken] Token could not be verified" ]]; then
80
80
-
# session="$(com.atproto.server.refreshSession)"
81
81
-
# error="$(atfile.util.get_xrpc_error $? "$session")"
82
82
-
#
83
83
-
# if [[ -n $error ]]; then
84
84
-
# atfile.cache.del "token"
85
85
-
# atfile.die.xrpc_error "Unable to refresh token" "$error"
86
86
-
# fi
87
87
-
#else
88
88
-
# atfile.die.xrpc_error "Unable to authenticate" "$error"
89
89
-
#fi
90
90
-
atfile.die.xrpc_error "Unable to authenticate" "$error"
79
79
+
if [[ $error == "[ExpiredToken]"* ]];then
80
80
+
session="$(com.atproto.server.refreshSession)"
81
81
+
error="$(atfile.util.get_xrpc_error $? "$session")"
82
82
+
83
83
+
if [[ -n $error ]]; then
84
84
+
atfile.cache.del "token"
85
85
+
atfile.die.xrpc_error "Unable to refresh session" "$error"
86
86
+
fi
87
87
+
else
88
88
+
atfile.die.xrpc_error "Unable to authenticate" "$error"
89
89
+
fi
91
90
else
92
91
_username="$(echo "$session" | jq -r ".did")"
93
92
fi
+1
-1
src/lexi/com_atproto.sh
···
77
77
78
78
function com.atproto.server.refreshSession() {
79
79
refresh_token="$(atfile.util.get_token_cache "refresh")"
80
80
-
atfile.xrpc.pds.get "com.atproto.server.refreshSession" "" "" "Bearer $refresh_token"
80
80
+
atfile.xrpc.pds.post "com.atproto.server.refreshSession" "" "" "Bearer $refresh_token"
81
81
}
82
82
83
83
function com.atproto.sync.uploadBlob() {