I’m having a small issue with accessing a Nakama server. We save logs in the storage module for each started match and later download these logs using a normal API call. The idea is to analyze the logs offline to get game balancing stats. I have a small Python script that does the downloading and it works mostly fine. The script downloads the logs one by one by requesting specific log files. As the local processing takes a few seconds a query is made maybe once every five seconds. So far so good.
After a short while I however get a 401 error from the server:
{"error":"Auth token invalid","message":"Auth token invalid","code":16}
The time until I get the error is perhaps a minute after my Python script authenticated ok. During this time I’ve downloaded a list of log file ids and then fetched some of the logs. It almost seems as if the authentication token expires, but that shouldn’t happen until after one hour according to the settings for the server.
def get_match_log(server: Server, match_log_id: str) -> Optional[typing.Dict]:
url = f"{server.url()}/v2/rpc/get_match_log?unwrap"
headers = CaseInsensitiveDict()
headers["Accept"] = "application/json"
headers["Authorization"] = f"Bearer {server.session_token}"
data = {
"match_id": match_log_id,
}
response = requests.post(url, json=data, headers=headers)
if response.status_code == 200:
return response.json()
print(response)
print(response.text)
return None
Our actual Unity game uses the same token for way longer without any issues. Is there some time limit that I’m not aware of here?