On November 17, 2014 Google deprecated v1 and v2 of its Google Calendar API using the Zend Framework.
It seems the only way to list publicly shared events on a publicly shared Google Calendar is through the new Google Client Library API from GitHub using OAuth 2.0
This means visitors to a public website that used to display public events now have to authenticate and login.
Is that true? Is there no other way to continue to show public Google Calendar events?
What you need to do is use a Service account for this. You will then be able add the service accounts email address as a user to the calendar for your website. The Service account will then be able to access this calendar including the events
You can still retrieve all public data without Oauth2, you just need to register in a developer console and create an API key. Then you can do:
GET https://www.googleapis.com/calendar/v3/calendars/<CALENDAR_EMAIL>/events?key={YOUR_API_KEY}
Related
I'm working on an application that does OAuth authorization on behalf of multiple users. My application wants to be able to create a calendar for user A and then share that calendar as read only to user B. It will then create events on that calendar so that they appear for user A as read/write and for user B as read only.
Obviously the Microsoft Graph API supports creating a calendar and putting events on it. My question pertains to the sharing part.
Does the Microsoft Graph API (or the Outlook 365 REST API) support sharing a calendar from one user to another user? I wouldn't want user B to receive the typical email that announces that user A shared a calendar with them. After creating the calendar under user A's account, I'd want to use user A's credentials to set up the sharing permission to user B. Then I would use user B's credentials to add the shared calendar to their list of calendars so that they see it in the Outlook 365 calendar interface.
I've read through a lot of the documentation and have been playing around with a prototype, but I can't find where this use case is supported.
I'm afraid this isn't possible to do via Microsoft Graph. The scenario seems reasonably straight forward, I recommend visiting the UserVoice and adding this suggestion.
I want to access to the calendar to read/create event from the user if he agrees.
I've followed the guide https://developers.google.com/google-apps/calendar/v3/sync
I've actived the api with my google account. Then use the OAuth 2.0 to get a code and the token.
When I follow the test, I use another account to simulate a random user.
Arrived at the lecture of the agenda, I get this error:
Error calling GET https://www.googleapis.com/calendar/v3/calendars/primary/events?maxResults=10&orderBy=startTime&singleEvents=true&timeMin=2016-06-14T11%3A28%3A25%2B02%3A00: (403) Access Not Configured. Calendar API has not been used in project 1056... before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/calendar/overview?project=1056... then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
It seems legit but I don't want the user to active the api on his side...
What am I missing?
Go to Google Developers console and enable the Google Calendar API. You need to tell Google which APIs your application will be accessing.
I need to access a NON-public Google calendar WITHOUT requiring the user to log in or even have a Google account.
I created an Android app that accesses a Google calendar using a service account:
GoogleCredential credential = new GoogleCredential.Builder()
.setTransport(httpTransport)
.setJsonFactory(jsonFactory)
.setServiceAccountId(serviceAccountID)
.setServiceAccountScopes(scopes)
.setServiceAccountPrivateKeyFromP12File(licenseFile)
.build();
com.google.api.services.calendar.Calendar.Builder builder = new com.google.api.services.calendar.Calendar.Builder(httpTransport, jsonFactory, credential);
builder.setApplicationName(appName);
com.google.api.services.calendar.Calendar client = builder.build();
com.google.api.services.calendar.Calendar.Events.List list = client.events().list(calendarID);
list.setMaxAttendees(maxAttendees);
list.setTimeZone(timeZone);
list.setTimeMin(startTime);
list.setTimeMax(endTime);
list.setOrderBy(orderBy);
list.setShowDeleted(showDeleted);
list.setSingleEvents(true);
Events events = list.execute();
This included:
Creating a project in the Google App console
Creating a Service Account
Giving the Service Account access rights to the Google calendar
It works GREAT!
I need to do the same thing in IOS. I have read every question/answer I can find on this topic and have found VERY different answers. Many say that Google hasn't allowed this in the IOS SDK because service accounts are intended to be used by server-based applications. I don't agree since the functionality I need is available in Android. So, now what?
The use case is this:
My IOS app needs to access a Google calendar. That part is not too tough if you are okay with using OAuth. My problems with this approach are:
Requires to user to have a Google account. Many of my users are Apple-Only. I can't require them to get a Google account just to use my app.
I can't make the calendar public. So, I would need to give access to every new user. I guess I could do that with a web-based application but this doesn't fix the problem (refer to previous problem - no Google account).
I really need to be able to query the events in the NON-public Google Calendar WITHOUT the user needing a Google account. The solution IS using a "Service Account" (I think).
I read one question/answer that said this is possible but the solution was never posted. (How to list Google Calendar Events without User Authentication)
HELP!!!!
The official documentation suggests that if you want to handle Calendar API (for example), you'll have to have a Google Apps for Work (source).
If you have a Google Apps domain—if you use Google Apps for Work, for example—an administrator of the Google Apps domain can authorize an application to access user data on behalf of users in the Google Apps domain. For example, an application that uses the Google Calendar API to add events to the calendars of all users in a Google Apps domain would use a service account to access the Google Calendar API on behalf of users.
Once the prerequisite is met, you can try to just call the REST URLs of Calendar API based on your implementation (since there seems to be no iOS support or samples available in the documentation).
I coded a desktop calendar application a while ago, based on an existing database for an older calendar.
A bit later I added functionality to interact with google calenders using the v2 api, that is deprecated for a while now. Functionality might brake in november: Deprecation Policy ..so I thought it's about time to update to the v3 api.
What my calendar application does related to google calendar:
Writing/Reading in a shared google calendar
Writing/Reading in own (multiple) private google calendars
Syncing private/shared google calendars into an own database.
In v2 it was pretty easy to login to any calendar having the credentials with the GoogleDataApi
CalendarService calService = new CalendarService("MyCalendar");
calService.setUserCredentials(account, password);
and then reading, writing, update events.
In the v3 api theres no clientlogin anymore, how would I proceed with oauth2 to achieve the same functionality? How would I let a user login from my desktop application to his google calendars, so he is able to sync/view/edit/add google events?
Updating is a good idea! For v3 you should take a look at Oauth2 for desktop app (you will need to get and store Oauth2 access token and a refresh token for your users to not need the user to re-enter their credentials). The calendar documentation for this: https://developers.google.com/google-apps/calendar/auth
The generic Oauth2 documentation: https://developers.google.com/accounts/docs/OAuth2InstalledApp
Some more documentation from drive: https://developers.google.com/drive/web/about-auth
And the most useful of all, the playground to try stuff out: https://developers.google.com/oauthplayground/
I'm using Google and external calendar sync (console application). I've tried several ways to connect to my calendar in Delphi. In the latest version of the Google API, you can choose two options:
API Key (public calendar)
OAuth2.0 (private calendar)
The calendar is not public. I looked at a couple of examples, but everywhere the need for user interaction. I want to identify myself with no user interaction. How can I do that?
I don't know about using it in Delphi but there is a client API library for java, python... I've already used the java one and it's clearly explained how to use it in the documentation.
Google Calendar API 3 Doc page:
https://developers.google.com/google-apps/calendar/
However, the service asks you to be authentified to used it (which is your problem if I understand it well, you don't want the user to have to authenticate). So I suggest you to have a look on OAuth2.0. https://developers.google.com/google-apps/calendar/auth
Here are some simple of using google-api-java-client for exemple : https://code.google.com/p/google-api-java-client/wiki/OAuth2
And you should look more precisely at Google OAuth service account possibilities.
Service Account with OAuth2.0. (See here : https://developers.google.com/accounts/docs/OAuth2#serviceaccount).
It will provide a service account for your application, from which you will be able to handle calendars for your app.
And here you will find a sample showing how to do it with Java. (https://code.google.com/p/google-api-java-client/wiki/OAuth2#Service_Accounts). But maybe this is the public API Key you are talking about... Not sure I remember properly.
I hope this will help you to figure out how to do it.