feat: Tink open banking demo — 6-step API walkthrough

Demonstrates the full Tink integration flow for open banking:
  Step 1 — Client credentials auth (app token)
  Step 2 — Create Tink user with external_user_id
  Step 3 — Connect bank via Tink Link OAuth redirect
  Step 4 — List accounts (v2 endpoint)
  Step 5 — List transactions (v2 endpoint, cursor pagination)
  Step 6 — Webhooks (register endpoint, receive events)

Built with Python / FastAPI + Jinja2 templates.
Each step shows live JSON responses, cURL examples and API version badges.
Includes server-side token store (prevents session cookie overflow),
asyncio lock on OAuth callback, and demo mode with realistic mock data.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Henrik Jess Nielsen
2026-05-23 02:08:27 +02:00
commit ab591be464
23 changed files with 2477 additions and 0 deletions

49
README.md Normal file
View File

@@ -0,0 +1,49 @@
# MoneyCapp × Tink API Demo
"Sales-y Swagger" — step-for-step gennemgang af Tink integrationsflowet med live JSON responses.
## Hvad det er
En hosted demo-app der viser hele Tink onboarding-flowet:
| Step | Endpoint | Version |
|------|----------|---------|
| 1 | POST `/api/v1/oauth/token` — Client Credentials | v1 |
| 2 | POST `/api/v1/user/create` — Opret bruger | v1 |
| 3 | Tink Link redirect — Tilslut bank | Link v1 |
| 4 | GET `/data/v2/accounts` — Konti med balances | **v2** |
| 5 | GET `/data/v2/transactions` — Transaktioner | **v2** |
| 6 | GET `/events/v2/account-transactions` + webhooks | **v2** |
## Quick start (lokal dev)
```bash
cp .env.example .env
# Udfyld TINK_CLIENT_ID og TINK_CLIENT_SECRET fra Tink Console
# Tilføj http://localhost:8000/callback som Redirect URI i Tink Console
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
uvicorn src.main:app --reload
# Åbn http://localhost:8000
```
## Docker
```bash
docker compose up
```
## Deploy til i80/Nomad
1. Konfigurer Gitea secrets: `REGISTRY_USER`, `REGISTRY_TOKEN`, `NOMAD_ADDR`, `NOMAD_TOKEN`
2. Læg Tink credentials i Nomad/Vault: `secret/moneycapp-tink-demo`
3. Tilføj `https://tink-demo.i80.dk/callback` som Redirect URI i Tink Console
4. Push til `main` → Gitea Actions bygger og deployer
## Tink Console setup
1. Gå til [console.tink.com](https://console.tink.com)
2. Opret en app → kopiér Client ID + Secret til `.env`
3. Under **Redirect URIs**: tilføj din callback URL
4. Under **Scopes**: aktiver `accounts:read`, `transactions:read`, `credentials:read/write`, `user:create`