fix: encrypt access_token when setting in db after refreshing access_token
This commit is contained in:
parent
c200f5b3ae
commit
8edae2ce09
1 changed files with 11 additions and 5 deletions
|
|
@ -102,12 +102,18 @@ class Oauth:
|
|||
def _refresh_access_token(self) -> str:
|
||||
"""Refreshes access token via calling `refresh_access_token` method of oauth service object"""
|
||||
service_obj = self._get_service_object()
|
||||
access_token = service_obj.refresh_access_token(self._refresh_token).get("access_token", None)
|
||||
access_token = service_obj.refresh_access_token(self._refresh_token).get("access_token")
|
||||
|
||||
if access_token:
|
||||
# set the new access token in db
|
||||
frappe.db.set_value(
|
||||
"Email Account",
|
||||
self.email_account,
|
||||
"access_token",
|
||||
encrypt(access_token),
|
||||
update_modified=False,
|
||||
)
|
||||
|
||||
# set the new access token in db
|
||||
frappe.db.set_value(
|
||||
"Email Account", self.email_account, "access_token", access_token, update_modified=False
|
||||
)
|
||||
return access_token
|
||||
|
||||
def _get_service_object(self):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue