mirror of
https://github.com/yawaflua/Flask-Discord.git
synced 2026-02-04 10:14:15 +02:00
Fix compatibility with pyjwt v2.0.0
This commit is contained in:
@@ -96,7 +96,7 @@ class DiscordOAuth2Session(_http.DiscordOAuth2HttpClient):
|
|||||||
data = data or dict()
|
data = data or dict()
|
||||||
data["__state_secret_"] = generate_token()
|
data["__state_secret_"] = generate_token()
|
||||||
|
|
||||||
state = jwt.encode(data, current_app.config["SECRET_KEY"]).decode(encoding="utf-8")
|
state = jwt.encode(data, current_app.config["SECRET_KEY"], algorithm="HS256")
|
||||||
|
|
||||||
discord_session = self._make_session(scope=scope, state=state)
|
discord_session = self._make_session(scope=scope, state=state)
|
||||||
authorization_url, state = discord_session.authorization_url(configs.DISCORD_AUTHORIZATION_BASE_URL)
|
authorization_url, state = discord_session.authorization_url(configs.DISCORD_AUTHORIZATION_BASE_URL)
|
||||||
@@ -157,7 +157,7 @@ class DiscordOAuth2Session(_http.DiscordOAuth2HttpClient):
|
|||||||
token = self._fetch_token(state)
|
token = self._fetch_token(state)
|
||||||
self.save_authorization_token(token)
|
self.save_authorization_token(token)
|
||||||
|
|
||||||
return jwt.decode(state, current_app.config["SECRET_KEY"])
|
return jwt.decode(state, current_app.config["SECRET_KEY"], algorithms="HS256")
|
||||||
|
|
||||||
def revoke(self):
|
def revoke(self):
|
||||||
"""This method clears current discord token, state and all session data from flask
|
"""This method clears current discord token, state and all session data from flask
|
||||||
|
|||||||
Reference in New Issue
Block a user