I'm trying to insert a new event using only an API Key
that I created.
The problem is that when I'm just checking available times using FreeBusy, everything works perfectly, but when I try to create and insert a new event, I get the following error:
Uncaught Google_Service_Exception: {
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
In the Authorizing Requests to the Google Calendar API page it is stated that:
Your application must use OAuth 2.0 to authorize requests. No other authorization protocols are supported. If your application uses Google Sign-In, some aspects of authorization are handled for you.
But I can't manually authorize access to the calendar every time it is asked for.
How can I authorize requests and insert new events without having to manually authorize them?
getRefreshToken()
github.com/googleapis/google-api-php-client/blob/master/src/… - lufc