fix: remove the token validation check

Let token be part of state to make state dynamic. But there is no need
to have validation for token.
This commit is contained in:
leela 2021-04-19 14:45:38 +05:30 committed by Suraj Shetty
parent 86aa060da5
commit 3fd5f75606

View file

@ -64,8 +64,6 @@ def get_oauth2_authorize_url(provider, redirect_to):
state = { "site": frappe.utils.get_url(), "token": frappe.generate_hash(), "redirect_to": redirect_to }
frappe.cache().set_value("{0}:{1}".format(provider, state["token"]), True, expires_in_sec=120)
# relative to absolute url
data = {
"redirect_uri": get_redirect_uri(provider),
@ -176,11 +174,6 @@ def login_oauth_user(data=None, provider=None, state=None, email_id=None, key=No
frappe.respond_as_web_page(_("Invalid Request"), _("Token is missing"), http_status_code=417)
return
token = frappe.cache().get_value("{0}:{1}".format(provider, state["token"]), expires=True)
if not token:
frappe.respond_as_web_page(_("Invalid Request"), _("Invalid Token"), http_status_code=417)
return
user = get_email(data)
if not user: