Skip to content

This project is a simple Java-based application that generates an OAuth2 access token using Google Cloud credentials. The credentials are loaded from a credentials.json file, and the application uses the Google API Client Libraries to authenticate and retrieve an access token. The token can then be used to interact with Google Cloud services.

Notifications You must be signed in to change notification settings

YsrajSingh/google-access-token-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Token Generator Project

This project generates tokens using Google authentication services, with necessary dependencies for handling HTTP requests, Google APIs, and OAuth2 authentication.

Project Structure

  • app/libs/: Contains external dependencies required for the project.

    • Google API client libraries
    • Google authentication libraries
    • Guava utility library
    • Gson (JSON parsing library)
    • Apache HTTP client libraries
    • OpenCensus and gRPC (for monitoring, tracing, and network communication)
  • app/src/: Contains configuration and resource files for the project.

    • credentials.json: Service account credentials for Google APIs authentication.
    • Main.java: The main Java application file responsible for initializing the token generator process. It handles OAuth2 authentication, refreshing tokens, and communicating with Google's API services.
  • app/build.sh: A shell script used to download the required dependencies (JAR files) from Maven repositories. This script will set up the libs/ directory and ensure all necessary libraries are available for the project to function properly.

Dependencies

This project requires the following external libraries:

  1. Google HTTP Client Libraries:

    • google-http-client-gson-1.42.3.jar
    • google-api-client-gson-1.33.2.jar
    • google-api-client-1.33.2.jar
  2. Guava (Utility Library):

    • guava-23.1-jre.jar
  3. Google Authentication Libraries:

    • google-auth-library-oauth2-http-1.20.0.jar
    • google-auth-library-credentials-1.20.0.jar
    • google-http-client-1.42.3.jar
  4. JSON Parsing:

    • gson-2.9.0.jar
  5. Apache HTTP Client Libraries:

    • httpclient-4.5.13.jar
    • httpcore-4.4.13.jar
  6. OpenCensus and gRPC (For tracing and monitoring):

    • opencensus-api-0.28.3.jar
    • opencensus-contrib-http-util-0.28.3.jar
    • grpc-context-1.45.1.jar
    • grpc-core-1.45.1.jar

Setup Instructions

  1. Clone the repository:

    git clone https://github.com/YsrajSingh/google-access-token-generator
    cd google-access-token-generator
    
  2. Download Dependencies: This project uses external dependencies hosted on Maven. To ensure the necessary JAR files are available, the following script downloads them:

    ./app/build.sh
    

    This will create the app/libs/ and download the required libraries.

  3. Run the Project:

    After setting up the dependencies, you can run the project using:

    docker-compose up
    

    This will start the container and load the necessary credentials to generate tokens using Google APIs.

  4. Modify Credentials

    Ensure that your credentials are correctly configured in the project, especially if using Google APIs. You'll need to have a service account JSON file with the required permissions. Update the credentials in the Main.java or corresponding Java file.

Optional Dependencies

If you are not using OpenCensus or gRPC for tracing and monitoring, you can remove the following dependencies:

  1. opencensus-api-0.28.3.jar
  2. opencensus-contrib-http-util-0.28.3.jar
  3. grpc-context-1.45.1.jar
  4. grpc-core-1.45.1.jar

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

This project is a simple Java-based application that generates an OAuth2 access token using Google Cloud credentials. The credentials are loaded from a credentials.json file, and the application uses the Google API Client Libraries to authenticate and retrieve an access token. The token can then be used to interact with Google Cloud services.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published