title: Google public calendar API returns error 401 login required when adding an event
body: <p>I want to insert an event in one of my public calendars using the following code, But it returns error 401 login required</p>
  <p>I am getting Request is missing required authentication credential. Expected OAuth 2 access token error while insert events. Where I am doing wrong ?</p>
  <p>Here is my code</p>
  <pre><code>      var mykey = &quot;MY API KEY&quot;;
        var calendarid = &quot;MY CALENDAR ID LIKE XXXXXX@group.calendar.google.com&quot;;
        var event = {
          summary: &quot;Google I/O 2015&quot;,
          location: &quot;800 Howard St., San Francisco, CA 94103&quot;,
          description: &quot;Heyyyyyy&quot;,
          start: {
            dateTime: &quot;2021-02-16T09:00:00-07:00&quot;,
            timeZone: &quot;America/Los_Angeles&quot;,
          },
          end: {
            dateTime: &quot;2021-02-17T17:00:00-07:00&quot;,
            timeZone: &quot;America/Los_Angeles&quot;,
          },
          recurrence: [&quot;RRULE:FREQ=DAILY;COUNT=2&quot;],
          attendees: [
            { email: &quot;lpage@example.com&quot; },
            { email: &quot;sbrin@example.com&quot; },
          ],
          reminders: {
            useDefault: false,
            overrides: [
              { method: &quot;email&quot;, minutes: 24 * 60 },
              { method: &quot;popup&quot;, minutes: 10 },
            ],
          },
        };
  
        $.ajax({
          type: &quot;POST&quot;,
          url: encodeURI(
            &quot;https://www.googleapis.com/calendar/v3/calendars/&quot; +
              calendarid +
              &quot;/events/?key=&quot; +
              mykey
          ),
          dataType: &quot;json&quot;,
          data: event,
          success: function (response) {
            //do whatever you want with each
          },
          error: function (response) {
            //tell that an error has occurred
          },
        });```
  
  Get API is working fine, but I am getting above error with post API.
  
  I do not know whY I am getting this error. Can anyone help me ? What is the issue ?
  
  </code></pre>