[cli] Load JSON if user pastes full response rather than just SID

This commit is contained in:
derrod 2021-10-06 07:24:33 +02:00
parent 4e539c4fd5
commit 26715695d8

View file

@ -150,7 +150,12 @@ class LegendaryCLI:
print('If web page did not open automatically, please manually open the following URL: '
'https://www.epicgames.com/id/login?redirectUrl=https://www.epicgames.com/id/api/redirect')
sid = input('Please enter the "sid" value from the JSON response: ')
sid = sid.strip().strip('"')
sid = sid.strip()
if sid[0] == '{':
tmp = json.loads(sid)
sid = tmp['sid']
else:
sid = sid.strip('"')
exchange_token = self.core.auth_sid(sid)
elif args.session_id:
exchange_token = self.core.auth_sid(args.session_id)