Skip to content

Commit

Permalink
Fix: Can't log in after token expires
Browse files Browse the repository at this point in the history
  • Loading branch information
MemoryShadow committed Aug 1, 2022
1 parent 71f79ba commit 131128e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -86,3 +86,4 @@ sftp-config.json

### pyCraft ###
credentials
Persistence/*
7 changes: 4 additions & 3 deletions minecraft/authentication.py
Expand Up @@ -442,10 +442,11 @@ def refresh(self):
XSTS = self.GetXSTS(XBL['Token'])
XBOX = self.GetXBOX(XSTS['Token'],XSTS['uhs'])
if self.GetProfile(XBOX):
print(f'账户: {self.profile.id_}')
self.PersistenceLogoin_w()
print(f'account: {self.profile.id_}')
return True
else:
print('账户不存在')
print('Account does not exist')
return False

def join(self, server_id):
Expand Down Expand Up @@ -501,7 +502,7 @@ def PersistenceLogoin_r(self, GameID: str):
Persistence = json.loads(Persistence)
self.access_token = Persistence["access_token"]
self.oauth20_refresh_token = Persistence["oauth20_refresh_token"]
self.GetProfile(self.access_token)
self.refresh()
return self.authenticated
else:
return False
Expand Down

0 comments on commit 131128e

Please sign in to comment.