Skip to content

sloshy/igdb-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IGDB Proxy Server

A simple Go proxy server that authenticates requests to the IGDB API (v4). It handles OAuth2 token generation/refreshing with Twitch and hides your Twitch Client credentials from the client.

Features

  • Proxies requests to https://api.igdb.com/v4.
  • Validates a client-side API Key (X-Proxy-Key).
  • Automatically handles Twitch OAuth2 Client Credentials flow.
  • Refreshes the access token 1 minute before expiration.
  • Injects Client-ID and Authorization headers into proxied requests.

Setup

  1. Build the server:

    go build -o igdb-proxy
  2. Run the server: You must provide the following environment variables:

    export PORT=8080                  # Optional, defaults to 8080
    export PROXY_API_KEYS="key1,key2" # Comma-separated list of keys
    export TWITCH_CLIENT_ID="abc..."  # Your Twitch Client ID
    export TWITCH_CLIENT_SECRET="xyz..." # Your Twitch Client Secret
    
    ./igdb-proxy

Usage

Make requests to the proxy just like you would to IGDB, but include your configured X-Proxy-Key header.

Example:

To fetch games from IGDB:

curl -X POST http://localhost:8080/games \
  -H "X-Proxy-Key: my-secret" \
  -H "Content-Type: text/plain" \
  -d "fields name, rating; limit 10;"

The proxy will forward this to https://api.igdb.com/v4/games with the correct authentication headers.

About

A simple client proxy server for the IGDB API

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages