mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-06 22:12:12 +02:00
refresh the token when expired
This commit is contained in:
parent
b0b6df0971
commit
9711af2b72
3 changed files with 27 additions and 26 deletions
|
|
@ -95,6 +95,7 @@ async def index_google_gmail_messages(
|
|||
|
||||
# Create credentials from connector config
|
||||
config_data = connector.config
|
||||
exp = config_data.get("expiry").replace("Z", "")
|
||||
credentials = Credentials(
|
||||
token=config_data.get("token"),
|
||||
refresh_token=config_data.get("refresh_token"),
|
||||
|
|
@ -102,6 +103,7 @@ async def index_google_gmail_messages(
|
|||
client_id=config_data.get("client_id"),
|
||||
client_secret=config_data.get("client_secret"),
|
||||
scopes=config_data.get("scopes", []),
|
||||
expiry=datetime.fromisoformat(exp),
|
||||
)
|
||||
|
||||
if (
|
||||
|
|
@ -125,7 +127,7 @@ async def index_google_gmail_messages(
|
|||
)
|
||||
|
||||
# Initialize Google gmail connector
|
||||
gmail_connector = GoogleGmailConnector(credentials)
|
||||
gmail_connector = GoogleGmailConnector(credentials, session, user_id)
|
||||
|
||||
# Fetch recent Google gmail messages
|
||||
logger.info(f"Fetching recent emails for connector {connector_id}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue