Use caps keys to store discord secrets in flask session object

This commit is contained in:
thecosmos
2019-05-26 10:56:15 +05:30
parent 1b2932f1b0
commit 9d5cbcdd77
3 changed files with 6 additions and 6 deletions

View File

@@ -35,7 +35,7 @@ class DiscordOAuth2Session(_http.DiscordOAuth2HttpClient):
scope = scope or request.args.get("scope", str()).split() or configs.DEFAULT_SCOPES
discord_session = self._make_session(scope=scope)
authorization_url, state = discord_session.authorization_url(configs.AUTHORIZATION_BASE_URL)
session["discord_oauth2_state"] = state
session["DISCORD_OAUTH2_STATE"] = state
return redirect(authorization_url)
def callback(self):
@@ -53,7 +53,7 @@ class DiscordOAuth2Session(_http.DiscordOAuth2HttpClient):
client_secret=self.client_secret,
authorization_response=request.url
)
session["discord_oauth2_token"] = token
session["DISCORD_OAUTH2_TOKEN"] = token
def revoke(self):
"""This method clears current discord token, state and all session data from flask