Skip to content

Commit dc5214f

Browse files
committed
Adding old style scitokens fallback
1 parent 0e3aaee commit dc5214f

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

stashcp.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,13 @@ def getToken():
138138

139139
# Read in the JSON
140140
with open(scitoken_file, 'r') as scitoken_obj:
141-
token_json = json.load(scitoken_obj)
142-
scitoken_contents = token_json['access_token']
141+
try:
142+
token_json = json.load(scitoken_obj)
143+
scitoken_contents = token_json['access_token']
144+
except ValueError as jsonfail:
145+
logging.info("Falling back to old style scitoken parsing")
146+
scitoken_obj.seek(0)
147+
scitoken_contents = scitoken_obj.read()
143148

144149
return scitoken_contents
145150

0 commit comments

Comments
 (0)