Skip to content

Backend is not removing google data after receiving invalid_grant #1483

@tyler-dane

Description

@tyler-dane

Where did this happen?

Hosted (app.compasscalendar.com)

Expected Behavior

After the backend receives an invalid_grant (Token has been expired or revoked) error, it should prune the google data and send a websocket notification to the client if connected. Then the client should refetch data and display a toast saying that Google data was removed due to access revoked.

Current Behavior

After the backend receives the grant error from the Google API request, it logs the invalid grant error and returns 400 for PUT /api/event/<id> with an empty response. However, it does not clean its data.

Steps to Reproduce

  1. Connect Google calendar account
  2. Revoke Google Access for Compass
  3. Make a change in Google, which'll trigger a webhook
  4. The backend will receive the GCal webhook and trigger a GET for the Google events, which'll trigger the invalid grant.
  5. The backend will respond with 400 POST /api/sync/gcal/notifications
  6. No change appears on the UI.
  7. In Compass UI, edit an existing event, trigger a PUT
  8. Backend responds with 400 PUT /api/event/<eventId>
  9. UI displays alert saying AxiosError: Request failed with status code 400

Possible Solution

Ensure the backend parses the error and cleans the data (it was working in previous version of code).

To improve the UX, ensure the backend notifies the client when this happens.

Context

Related to #1239 #52

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendWork related to improving the Compass API. More than 70% of the PR should be backend focused.webFrontend/web related issue

    Type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions