Add DISCORD_USER_ID in SESSION_KEYS. Try removing user from cache if exists

This commit is contained in:
thec0sm0s
2020-05-14 21:01:10 +05:30
parent 57ddb9e27f
commit 224d0570f5
2 changed files with 5 additions and 0 deletions

View File

@@ -34,6 +34,7 @@ class DiscordOAuth2HttpClient(abc.ABC):
""" """
SESSION_KEYS = [ SESSION_KEYS = [
"DISCORD_USER_ID",
"DISCORD_OAUTH2_STATE", "DISCORD_OAUTH2_STATE",
"DISCORD_OAUTH2_TOKEN", "DISCORD_OAUTH2_TOKEN",
] ]

View File

@@ -61,6 +61,10 @@ class DiscordOAuth2Session(_http.DiscordOAuth2HttpClient):
to go through discord authorization token grant flow again. to go through discord authorization token grant flow again.
""" """
user_id = session.get("DISCORD_USER_ID")
self.users_cache.pop(user_id, None)
for session_key in self.SESSION_KEYS: for session_key in self.SESSION_KEYS:
try: try:
session.pop(session_key) session.pop(session_key)