Skip to content
This repository was archived by the owner on May 7, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions .classpath
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="libs/json.jar"/>
<classpathentry kind="lib" path="libs/dom4j-1.6.1.jar"/>
<classpathentry kind="lib" path="libs/jaxen-1.1.3.jar"/>
<classpathentry kind="lib" path="libs/jtidy.jar"/>
<classpathentry kind="lib" path="libs/junit-4.11.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="libs/json.jar"/>
<classpathentry kind="lib" path="libs/dom4j-1.6.1.jar"/>
<classpathentry kind="lib" path="libs/jaxen-1.1.3.jar"/>
<classpathentry kind="lib" path="libs/jtidy.jar"/>
<classpathentry kind="lib" path="libs/junit-4.11.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
*.class

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear
.svn

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
.DS_Store
34 changes: 17 additions & 17 deletions .project
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>google-voice-java</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>google-voice-java</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
165 changes: 165 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.


This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.

0. Additional Definitions.

As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.

"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.

An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.

A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".

The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.

The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.

1. Exception to Section 3 of the GNU GPL.

You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.

2. Conveying Modified Versions.

If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:

a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or

b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.

3. Object Code Incorporating Material from Library Header Files.

The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:

a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.

b) Accompany the object code with a copy of the GNU GPL and this license
document.

4. Combined Works.

You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:

a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.

b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.

c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.

d) Do one of the following:

0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.

1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.

e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)

5. Combined Libraries.

You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:

a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.

b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.

6. Revised Versions of the GNU Lesser General Public License.

The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.

Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.

If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
96 changes: 95 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,95 @@
The original API for Google Voice. This could possibly be revived if the login and token can be renegotiated. The client login API it is based on no longer works.
# Google Voice Java Library (Unofficial)

An unofficial Java API for interacting with Google Voice. This library is currently being modernized.

## Notice
This project has recently been migrated to Gradle and uses OAuth 2.0 for authentication.
The previous ClientLogin authentication method is no longer supported as it has been deprecated by Google.

## Prerequisites
- Java Development Kit (JDK) 17 or higher.
- Git (for cloning the repository).
- A Google Account with Google Voice.
- OAuth 2.0 Client Credentials (`client_secret.json`) from Google Cloud Console.

## Building the Project
This project uses Gradle with Kotlin DSL.

1. **Clone the repository:**
```bash
git clone [YOUR_REPOSITORY_URL_HERE]
cd google_voice_java
```
(Replace `google_voice_java` with the actual directory name if different)
2. **Build the project:**
Use the Gradle wrapper (recommended):
```bash
./gradlew build
```
Or, if you have Gradle installed:
```bash
gradle build
```
This will compile the code, run tests, and create a JAR file in `build/libs/`.

Common Gradle tasks:
- `clean`: Cleans the build directory.
- `jar`: Creates the library JAR.
- `sourcesJar`: Creates a JAR with source files.
- `javadocJar`: Creates a JAR with Javadoc.
- `dokkaHtml`: Generates Dokka HTML documentation for Kotlin/Java (output in `build/docs/dokka/`).
- `test`: Runs unit tests.

## Authentication (OAuth 2.0 Setup - One Time)
This library uses OAuth 2.0 for authentication with Google. You need to set this up once.

1. **Obtain OAuth 2.0 Credentials:**
* Go to the [Google Cloud Console](https://console.cloud.google.com/).
* Create a new project or select an existing one.
* Enable the Google People API (or any other relevant APIs if specific Voice API scopes are identified and used later).
* Go to "Credentials", click "Create Credentials", and choose "OAuth client ID".
* Select "Desktop app" as the application type.
* Name your client (e.g., "GoogleVoiceJavaDesktopApp").
* After creation, download the JSON credentials file. Rename it to `client_secret.json`.
2. **Place `client_secret.json`:**
* Put the downloaded and renamed `client_secret.json` file into the root directory of this project.
3. **Configure Redirect URI:**
* In the Google Cloud Console, under your newly created OAuth Client ID, ensure you add a "Authorized redirect URI".
* This URI **must be** `http://localhost:8888/Callback` (the port `8888` is what the current authentication helper uses).
4. **Run the Authentication Task:**
Open your terminal in the project root and run:
```bash
./gradlew initiateGoogleAuth
```
* This task will print further instructions and should automatically open a URL in your web browser.
* Log in with your Google account and grant the requested permissions.
* Upon successful authorization, an access token and refresh token will be stored securely in your user's home directory (typically `~/.credentials/google-voice-java/`).
* A file named `google-auth.properties` containing the necessary `AUTH_TOKEN` will also be created in that directory. The application (specifically `GVCookieManager`) will load this file for subsequent API calls.

## Using the Library
After successful authentication, you can use the library.
(Details on how `GVCookieManager` now uses the OAuth token and how `Voice.java` makes authenticated calls can be added here or kept in more detailed class/method documentation).

Example (conceptual, assuming Voice class usage remains similar):
```java
// GVCookieManager automatically loads the token from google-auth.properties
// when getInstance() is called.
// The Voice class constructor no longer requires username/password for authentication.
// It will rely on the token loaded by GVCookieManager.
Voice voice = new Voice();

try {
String inboxHtml = voice.getInbox(); // This call should now use the OAuth token
System.out.println(inboxHtml);
} catch (IOException e) {
e.printStackTrace();
}
```
**Note:** The `Voice` class constructors and methods that previously relied on username/password or the old `authToken` field will now automatically attempt to use the OAuth token loaded by `GVCookieManager`. The old constructors taking username/password are still present but their authentication mechanism (ClientLogin) is deprecated and will likely fail or not be used if an OAuth token is present.

## Contributing
(Add contribution guidelines if any)

## License
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
(Verify the actual LICENSE file if it's different).
Loading