3

We are facing an issue at the time of redirection to create Google calendar event URL Error: enter image description here

Access blocked: project-Client_Id request is invalid, You can’t sign in because project-Client_Id sent an invalid request. You can try again later, or contact the developer about this issue.

We had created the object of the Event. Then added the event to Google Calendar.

Library Used : googleapis: ^11.3.0 googleapis_auth: ^1.4.1 url_launcher: ^6.1.12

class CalendarClient {
  static const _scopes = [CalendarApi.calendarScope];

 insert(title, startTime, endTime) {
 var _clientID = new ClientId(
    "Client_ID",
    "");
  clientViaUserConsent(_clientID, _scopes, prompt).then((AuthClient 
  client) {
  var calendar = CalendarApi(client);
  calendar.calendarList.list().then((value) => 
  print("VAL________$value"));

  String calendarId = "primary";
  Event event = Event(); // Create object of event

  event.summary = title;

  EventDateTime start = new EventDateTime();
  start.dateTime = startTime;
  start.timeZone = "GMT+05:00";
  event.start = start;

  EventDateTime end = new EventDateTime();
  end.timeZone = "GMT+05:00";
  end.dateTime = endTime;
  event.end = end;
  try {
    calendar.events.insert(event, calendarId).then((value) {
      print("ADDEDDD_________________${value.status}");
      if (value.status == "confirmed") {
        log('Event added in google calendar');
      } else {
        log("Unable to add event in google calendar");
      }
    });
  } catch (e) {
    log('Error creating event $e');
  }
});
}
void prompt(String url) async {
print("Please go to the following URL and grant access:");
print("  => $url,, Start Time  >> ");
print("");

if (await canLaunchUrl(Uri.parse(url))) {
  await launchUrl(Uri.parse(url));
} else {
  throw 'Could not launch $url';
}
}
}
4
  • please include your code Commented Jul 13, 2023 at 13:50
  • @LindaLawton-DaImTo Code added please review Commented Jul 17, 2023 at 6:34
  • are you using flutter for an installed app or a mobile app medium.com/flutter-community/… Commented Jul 17, 2023 at 12:44
  • Yes follow the same article and still getting the same issue @LindaLawton-DaImTo Commented Jul 18, 2023 at 5:34

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.