From 3c5d221b70e84af5e729dd15f9c55165fa6cea68 Mon Sep 17 00:00:00 2001 From: thecosmos Date: Mon, 20 May 2019 21:10:21 +0530 Subject: [PATCH] Add authorized property --- flask_discord/client.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/flask_discord/client.py b/flask_discord/client.py index d8279d7..125481b 100644 --- a/flask_discord/client.py +++ b/flask_discord/client.py @@ -61,13 +61,18 @@ class DiscordOAuth2Session(_http.DiscordOAuth2HttpClient): def revoke(self): """This method clears current discord token, state and all session data from flask - session . Which means user will have + `session `_. Which means user will have to go through discord authorization token grant flow again. """ for session_key in self.SESSION_KEYS: session.pop(session_key) + @property + def authorized(self): + """A boolean indicating whether current session has authorization token or not.""" + return self._make_session().authorized + def fetch_user(self): return models.User(self.get("/users/@me"))