1.3 KiB
1.3 KiB
OAuth2 Proxy integration
This example shows how to integrate with OAuth2 Proxy for authorization. For a gateway-native browser login flow, use the oidc example instead.
In this example, we set up GitHub OAuth authentication. The same pattern can be used with other providers, or with other authentication sources.
Running the example
First, create a GitHub OAuth App.
Use http://localhost:3000/oauth2/callback as the callback URL. Then take note of the Client ID
and Client Secret, and start OAuth2 Proxy locally:
export OAUTH2_PROXY_CLIENT_SECRET=...
export OAUTH2_PROXY_CLIENT_ID=...
export OAUTH2_PROXY_COOKIE_SECRET=`python -c 'import os,base64; print(base64.b64encode(os.urandom(16)).decode("ascii"))'`
docker compose -f examples/oauth2-proxy/docker-compose.yaml up
Note: the example configuration of OAuth2 Proxy uses a minimal setup to get started. Review the OAuth2 Proxy documentation for real-world usage.
Then run agentgateway:
cargo run -- -f examples/oauth2-proxy/config.yaml
Requests to http://localhost:3000 should automatically redirect to a GitHub sign-in page.