Files
whattoplay/docs/BLIZZARD-SETUP.md
T

139 lines
2.9 KiB
Markdown

# Blizzard Setup für WhatToPlay
## API OAuth Konfiguration
### 1. Battle.net Developer Portal öffnen
- Gehe zu https://develop.battle.net
- Melde dich mit deinem Battle.net Account an
### 2. Application registrieren
- Klicke auf "Create Application"
- Name: "WhatToPlay" (oder dein Projektname)
- Website: https://whattoplay.local (für Development)
- Beschreibung: "Game Library Manager"
- Akzeptiere die ToS
### 3. OAuth Credentials kopieren
Nach der Registrierung siehst du:
- **Client ID** - die öffentliche ID
- **Client Secret** - HALTEN Sie geheim! (Nur auf Server, nie im Browser!)
### 4. Redirect URI setzen
In deiner Application Settings:
```
Redirect URIs:
https://whattoplay-oauth.workers.dev/blizzard/callback (Production)
http://localhost:3000/auth/callback (Development)
```
---
## config.local.json Setup
```json
{
"blizzard": {
"clientId": "your_client_id_here",
"clientSecret": "your_client_secret_here",
"region": "eu"
}
}
```
### Region Codes:
- `us` - North America
- `eu` - Europe
- `kr` - Korea
- `tw` - Taiwan
---
## Blizzard Games, die unterstützt werden
1. **World of Warcraft** - Character-basiert
2. **Diablo III** - Hero-basiert
3. **Diablo IV** - Charakter-basiert
4. **Overwatch 2** - Account-basiert
5. **Starcraft II** - Campaign Progress
6. **Heroes of the Storm** - Character-basiert
7. **Hearthstone** - Deck-basiert
---
## Development vs Production
### Development (Lokal)
```bash
# Teste mit lokalem Token
npm run import
# Script verwendet config.local.json
```
### Production (Mit Cloudflare Worker)
```
Frontend → Cloudflare Worker → Blizzard OAuth
Token Exchange
(Client Secret sicher!)
```
Siehe: [CLOUDFLARE-WORKERS-SETUP.md](./CLOUDFLARE-WORKERS-SETUP.md)
---
## Troubleshooting
### "Client ID invalid"
- Überprüfe dass die Client ID korrekt kopiert wurde
- Stelle sicher dass du im Development Portal angemeldet bist
### "Redirect URI mismatch"
- Die Redirect URI muss exakt übereinstimmen
- Beachte Protocol (https vs http)
- Beachte Port-Nummern
### "No games found"
- Dein Account muss mindestens 1 Blizzard Game haben
- Bei Diablo III: Character muss erstellt sein
- Charaktere können bis zu 24h brauchen zum Erscheinen
### Token-Fehler in Production
- Client Secret ist abgelaufen → Neu generieren
- Überprüfe Cloudflare Worker Logs:
```bash
npx wrangler tail whattoplay-blizzard
```
---
## Sicherheit
🔒 **Wichtig:**
- **Client Secret** NIEMALS ins Frontend committen
- Nutze Cloudflare KV Store oder Environment Variables
- Token mit Ablaufdatum (expires_in) prüfen
- Token nicht in Browser LocalStorage speichern (nur Session)
---
## Links
- [Battle.net Developer Portal](https://develop.battle.net)
- [Blizzard OAuth Documentation](https://develop.battle.net/documentation/guides/using-oauth)
- [Game Data APIs](https://develop.battle.net/documentation/guides/game-data-apis)