neodb-get-access-token

January 6, 2025 ยท View on GitHub

A utility script to help you obtain an access token for the NeoDB API through OAuth2 PKCE authentication flow.

What This Script Does

  1. Initiates OAuth2 PKCE (Proof Key for Code Exchange) flow to securely obtain a NeoDB API access token
  2. Opens your default browser to complete the authentication process
  3. Returns the access token that can be used with NeoDB's API

Setup

  1. Install uv (if not already installed):
curl -LsSf https://astral.sh/uv/install.sh | sh
  1. Create and activate a virtual environment:
uv venv
source .venv/bin/activate  # On Unix/macOS
# or
.venv\Scripts\activate     # On Windows
  1. Install dependencies using uv:
uv pip install .

How to Run

python main.py

Customization

You can modify both the base URL and redirect URL according to your needs:

  • Base URL: Can be changed to:

    • https://neodb.social (default NeoDB instance)
    • Your self-hosted NeoDB instance URL
  • Redirect URL: Can be any URL that:

    • You've configured in your NeoDB application settings
    • Is accessible on your system (e.g., http://localhost:8000)

How to Run

python main.py <BASE_URL> <REDIRECT_URL>

For example:

python main.py https://neodb.social http://localhost:8000

Make sure the redirect URL matches what you've configured in your NeoDB application settings.

License

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