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 beefa7c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,4 @@ sftp-config.json

### pyCraft ###
credentials
Persistence/*
8 changes: 5 additions & 3 deletions minecraft/authentication.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from this import s
import requests
import json
import uuid
Expand Down Expand Up @@ -442,10 +443,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 +503,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 beefa7c

Please sign in to comment.