Skip to content

Commit

Permalink
Support service account
Browse files Browse the repository at this point in the history
closes #157
  • Loading branch information
kuzmoyev committed May 10, 2024
1 parent 001ae21 commit dc804a0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion docs/source/change_log.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ API
* Adds `add_attendees` method to the `Event` for adding multiple attendees.
* Add specific time reminders (N days before at HH:MM)
* Support Python3.12
* Allow service account credentials in `GoogleCalendar`

Core
----
* None

Backward compatibility
----------------------
* Full compatibility
* If token is expired but doesn't have refresh token, raises `google.auth.exceptions.RefreshError`
instead of sending the request.


v2.2.0
Expand Down
4 changes: 2 additions & 2 deletions gcsa/_services/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from googleapiclient import discovery
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials
from google.auth.credentials import Credentials


class AuthenticatedService:
Expand Down Expand Up @@ -80,7 +80,7 @@ def __init__(
def _ensure_refreshed(
credentials: Credentials
) -> Credentials:
if not credentials.valid and credentials.expired and credentials.refresh_token:
if not credentials.valid and credentials.expired:
credentials.refresh(Request())
return credentials

Expand Down

0 comments on commit dc804a0

Please sign in to comment.