Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/choonchernlim/calsync
Browse files Browse the repository at this point in the history
  • Loading branch information
choonchernlim committed Sep 1, 2020
2 parents bbb203c + 87276dd commit 01b5388
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 30 deletions.
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,20 @@ Syncs events from Microsoft Exchange calendar to Google calendar.

* Enable Google Calendar API (steps provided by Google):-
* Use [this wizard](https://console.developers.google.com/start/api?id=calendar) to create or select a project in the Google Developers Console and automatically turn on the API. Click **Continue**, then **Go to credentials**.
* On the **Add credentials to your project** page, click the **Cancel** button.
* At the top of the page, select the **OAuth consent screen** tab. Select an **Email address**, enter a **Product name** if not already set, and click the **Save** button.
* Select the **Credentials** tab, click the **Create credentials** button and select **OAuth client ID**.
* Select the application type **Other**, enter the name "Google Calendar API", and click the **Create** button.
* Click **OK** to dismiss the resulting dialog.
* Click the "Download JSON" button to the right of the client ID.
* Rename it `client_secret.json`.
* On the **Add credentials to your project** page, click **Cancel**.
* Select the **OAuth consent screen** tab.
* Click **EDIT APP** link.
* Specify **Application name** (if missing).
* Select an **Email address**.
* Click **Save**.
* Select the **Credentials** tab.
* Click the **Create credentials**
* Select **OAuth client ID**.
* Application type: **Desktop app**
* Name: **Google Calendar API**
* Click **Create**.
* Click **Download** icon to the right of the client ID.
* Rename downloaded JSON file as `client_secret.json`.

* Place `client_secret.json` beside `calsync.jar`.

Expand Down
38 changes: 22 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@

<groupId>com.github.choonchernlim</groupId>
<artifactId>calsync</artifactId>
<version>0.5.0</version>
<version>0.6.0</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<jdk.version>1.8</jdk.version>
<groovy.version>2.5.8</groovy.version>
<groovy-eclipse-compiler.version>3.5.0-01</groovy-eclipse-compiler.version>
<groovy-eclipse-batch.version>2.5.8-02</groovy-eclipse-batch.version>
<groovy.version>3.0.5</groovy.version>
<groovy-eclipse-compiler.version>3.6.0-03</groovy-eclipse-compiler.version>
<groovy-eclipse-batch.version>3.0.5-01</groovy-eclipse-batch.version>
</properties>

<dependencies>
Expand All @@ -38,52 +38,52 @@
</dependency>

<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.13.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
<version>1.7.30</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.21</version>
<version>1.7.30</version>
</dependency>

<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.10.4</version>
<version>2.10.6</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.12.1</version>
<version>1.13.1</version>
</dependency>

<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-calendar</artifactId>
<version>v3-rev20190929-1.30.3</version>
<version>v3-rev411-1.25.0</version>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-jackson2</artifactId>
<version>1.32.1</version>
<version>1.35.0</version>
</dependency>
<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client-jetty</artifactId>
<version>1.30.3</version>
<version>1.30.6</version>
</dependency>

<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>1.3-groovy-2.5</version>
<version>2.0-M3-groovy-3.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -192,6 +192,12 @@
</includes>
</configuration>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.7</version>
</plugin>
</plugins>
</build>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ class GoogleClient {
'/path/to/client_secrets.json')
}

// set up authorization code flow
// Build flow and trigger user authorization request.
GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder(
httpTransport, jsonFactory, clientSecrets, [CalendarScopes.CALENDAR]).
setDataStoreFactory(dataStoreFactory)
.build()

// configure
Credential credential = new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize('user')
setDataStoreFactory(dataStoreFactory).
setAccessType("offline").
build()
LocalServerReceiver receiver = new LocalServerReceiver.Builder().setPort(8888).build()
Credential credential = new AuthorizationCodeInstalledApp(flow, receiver).authorize("user")

return new com.google.api.services.calendar.Calendar.Builder(httpTransport, jsonFactory, credential).
setApplicationName(Constant.PROJECT_ID).
Expand Down Expand Up @@ -203,4 +203,4 @@ class GoogleClient {
private static String prettyPrintEvent(CalSyncEvent event) {
return "${Mapper.humanReadableDateTime(event.startDateTime)} - ${event.subject}"
}
}
}

0 comments on commit 01b5388

Please sign in to comment.