Skip to content

Dependency Parsing: Automatically extracts and lists all dependencies from GitHub repositories, simplifying project management and analysis.

Notifications You must be signed in to change notification settings

felixphilipk/Springboot_CodeTalker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation


Spring Boot Application - CodeTalker

CodeTalker is a Spring Boot application designed to interface with GitHub repositories, allowing users to fetch dependency information from pom.xml files within specified repositories using GitHub's OAuth for secure access.

Prerequisites

Before running the application, ensure you have the following installed:

Running the Application Locally

  1. Clone the repository from GitHub.
  2. Navigate to the application directory where the pom.xml is located.
  3. Run the following command to start the application:
mvn spring-boot:run

The application should now be running on http://localhost:8080.

Calling Endpoints via Postman

  1. Open Postman.
  2. Create a new GET request to http://localhost:8080/api/dependencies.
  3. Add query parameters:
    • repoName: The name of the GitHub repository.
    • owner: The GitHub username or organization that owns the repository.

GitHub OAuth Authentication Flow

To access the GitHub API, the application uses OAuth for authentication. Here's how the flow works:

  1. Request a User's GitHub Identity:

    • Send a GET request to https://github.com/login/oauth/authorize with the required parameters, including client_id and optional redirect_uri, login, scope, state, and allow_signup.
  2. Users Are Redirected Back to Your Site by GitHub:

    • If the user accepts the request, GitHub redirects back to your site with a temporary code and the provided state.
    • Exchange this code for an access token by sending a POST request to https://github.com/login/oauth/access_token with client_id, client_secret, code, and optional redirect_uri.
  3. Use the Access Token to Access the API:

    • The access token allows you to make requests to the API on behalf of a user.
    • Set the Authorization header as Bearer OAUTH-TOKEN in your API requests.

Using Postman for GitHub OAuth

In Postman, you can simulate the OAuth flow:

  1. Get the Authorization Code:

    • Manually navigate to the authorization URL in your web browser or set up an OAuth 2.0 authorization request in Postman with the Auth URL and the necessary parameters.
  2. Get the Access Token:

    • Use the "

Code" obtained in the previous step to make a POST request in Postman to the token URL with the required parameters (client ID, client secret, and code).

  1. Call the API Using the Access Token:
    • Set up your GET request in Postman to the endpoint.
    • Under the "Authorization" tab, select "Bearer Token" and paste your access token.
    • Send the request to interact with the GitHub API.

Example Request in Postman

  1. Set up a GET request to http://localhost:8080/api/dependencies with the following query parameters:

    • Key: repoName, Value: [your-repo-name]
    • Key: owner, Value: [repo-owner]
  2. In the "Headers" section, add the following:

    • Key: Authorization, Value: Bearer [your-github-access-token]
  3. Send the request.

Troubleshooting

  • Ensure the Spring Boot application is running and accessible.
  • Confirm that you have correctly set up your GitHub OAuth application and that the client_id and redirect_uri match what is registered on GitHub.
  • If you encounter any issues with the OAuth flow, review the GitHub documentation and ensure that the application's callback URL is correctly configured to handle the OAuth2 callback from GitHub.

About

Dependency Parsing: Automatically extracts and lists all dependencies from GitHub repositories, simplifying project management and analysis.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published