Skip to content

Commit 1d75868

Browse files
author
Ludvik Jerabek
committed
Fix refresh token 5 minutes before it expires
1 parent f68580c commit 1d75868

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/ser_mail_api/v1/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ def __init__(self, client_id: str, client_secret: str):
4242
# Deal with OAuth2
4343
oauth2_client = OAuth2Client("https://mail.ser.proofpoint.com/v1/token", auth=(client_id, client_secret))
4444
oauth2_client.client_credentials({"grant_type": "client_credentials"})
45-
self._session.auth = OAuth2ClientCredentialsAuth(oauth2_client, scope="client_credentials")
45+
# Refresh token 5 minutes before expiration, this is documented in the API guide.
46+
self._session.auth = OAuth2ClientCredentialsAuth(oauth2_client,leeway=300, scope="client_credentials")
4647
self.__send = Send(self, 'send')
4748

4849
@property

0 commit comments

Comments
 (0)