2026-05-23 02:08:27 +02:00
|
|
|
|
# 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
|
|
|
|
|
|
|
fix: production deployment — Docker, Nomad, Consul KV, SHA tags
- Dockerfile: multi-stage build, non-root user, src/static tracked with .gitkeep
- Nomad job: force_pull=true, Traefik router fixed to tink-demo.i80.dk,
loadbalancer.server.port=8000, job renamed from moneycapp-tink-demo
- CI/CD: git SHA image tags (deterministic deploys), removed .env.production
baking — secrets injected at runtime via Consul KV template stanza
- Session security: asyncio lock prevents duplicate code exchange on callback,
guard for already-stored token, api_log moved server-side (cookie overflow fix)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-23 02:08:27 +02:00
|
|
|
|
> **Kun relevant for i80-infrastruktur.** For din egen infra: byg Docker image og kør med env vars.
|
2026-05-23 02:08:27 +02:00
|
|
|
|
|
fix: production deployment — Docker, Nomad, Consul KV, SHA tags
- Dockerfile: multi-stage build, non-root user, src/static tracked with .gitkeep
- Nomad job: force_pull=true, Traefik router fixed to tink-demo.i80.dk,
loadbalancer.server.port=8000, job renamed from moneycapp-tink-demo
- CI/CD: git SHA image tags (deterministic deploys), removed .env.production
baking — secrets injected at runtime via Consul KV template stanza
- Session security: asyncio lock prevents duplicate code exchange on callback,
guard for already-stored token, api_log moved server-side (cookie overflow fix)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-23 02:08:27 +02:00
|
|
|
|
1. Læg credentials i Consul KV:
|
|
|
|
|
|
```bash
|
|
|
|
|
|
consul kv put tink-demo/TINK_CLIENT_ID <din_client_id>
|
|
|
|
|
|
consul kv put tink-demo/TINK_CLIENT_SECRET <din_client_secret>
|
|
|
|
|
|
```
|
|
|
|
|
|
2. Tilføj `https://tink-demo.i80.dk/callback` som Redirect URI i Tink Console
|
|
|
|
|
|
3. Push til `main` → Gitea Actions bygger og deployer automatisk
|
|
|
|
|
|
|
|
|
|
|
|
## Docker (self-hosted)
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
cp .env.example .env
|
|
|
|
|
|
# Udfyld TINK_CLIENT_ID og TINK_CLIENT_SECRET
|
|
|
|
|
|
docker compose up
|
|
|
|
|
|
```
|
2026-05-23 02:08:27 +02:00
|
|
|
|
|
|
|
|
|
|
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`
|