V
V
Vladislav2022-04-13 11:07:57
Google
Vladislav, 2022-04-13 11:07:57

Google Calendar API working through Backend?

Guys tell me if there is a workaround.
My task is simple, I need to create events in the Google calendar through the backend.

But Google writes that you can only communicate with its API via OAuth2: https://developers.google.com/calendar/api/guides/auth
And I need to do this from the php backend, maybe you know how to do it? Api key and service account I tried they don't fit that's for sure.
He writes something like this:

{
  "error": {
    "code": 401,
    "message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
    "errors": [
      {
        "message": "Login Required.",
        "domain": "global",
        "reason": "required",
        "location": "Authorization",
        "locationType": "header"
      }
    ],
    "status": "UNAUTHENTICATED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "CREDENTIALS_MISSING",
        "domain": "googleapis.com",
        "metadata": {
          "service": "calendar-json.googleapis.com",
          "method": "calendar.v3.Events.Insert"
        }
      }
    ]
  }
}


And like this:
{
  "error": "unauthorized_client",
  "error_description": "Client is unauthorized to retrieve access tokens using this method, or client not authorized for any of the scopes requested."
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question