docs(consultations): Add Gemini Technic API fix consultation
The 401 error was caused by hardcoded ?build=1 parameter. Technic blocks old launcher versions. Fix: dynamically fetch current build number from /launcher/version/stable4. 'RV-Ready' solution requiring zero maintenance. Signed-off-by: Claude (Chronicler #63) <claude@firefrostgaming.com>
This commit is contained in:
87
docs/consultations/gemini-technic-api-fix-2026-04-06.md
Normal file
87
docs/consultations/gemini-technic-api-fix-2026-04-06.md
Normal file
@@ -0,0 +1,87 @@
|
||||
# Gemini Consultation: Technic API 401 Unauthorized Fix
|
||||
|
||||
**Date:** April 6, 2026
|
||||
**Chronicler:** #63
|
||||
**Task:** #26 ModpackChecker Phase 5 Deployment
|
||||
|
||||
---
|
||||
|
||||
## The Problem
|
||||
|
||||
Technic API was returning `401 Unauthorized` for all requests:
|
||||
|
||||
```php
|
||||
$response = Http::get('https://api.technicpack.net/modpack/tekkit?build=1');
|
||||
// Returns: {"status":401,"error":"Unauthorized"}
|
||||
```
|
||||
|
||||
We initially suspected authentication requirements had changed.
|
||||
|
||||
---
|
||||
|
||||
## Gemini's Diagnosis
|
||||
|
||||
**It wasn't authentication — it was version control.**
|
||||
|
||||
Technic actively blocks requests claiming to come from ancient or deprecated launcher builds. By hardcoding `?build=1`, we were telling the API we're using build #1 of the Technic Launcher. The API rejects this outdated build number.
|
||||
|
||||
The current stable build number is in the high 700s/800s.
|
||||
|
||||
---
|
||||
|
||||
## The "RV-Ready" Fix
|
||||
|
||||
Instead of hardcoding a higher number (which could eventually be deprecated too), we dynamically fetch the current build number:
|
||||
|
||||
```php
|
||||
private function checkTechnic(string $slug): array
|
||||
{
|
||||
// Step 1: Get current stable launcher build number
|
||||
$versionResponse = Http::get('https://api.technicpack.net/launcher/version/stable4');
|
||||
$latestBuild = $versionResponse->successful()
|
||||
? ($versionResponse->json('build') ?? 999)
|
||||
: 999; // Fallback to high number if version check fails
|
||||
|
||||
// Step 2: Fetch modpack data with valid build number
|
||||
$response = Http::withHeaders([
|
||||
'User-Agent' => 'FirefrostGaming/ModpackChecker/1.0',
|
||||
'Accept' => 'application/json',
|
||||
])->get("https://api.technicpack.net/modpack/{$slug}?build={$latestBuild}");
|
||||
|
||||
if (!$response->successful()) {
|
||||
throw new \Exception('Technic API request failed: ' . $response->status());
|
||||
}
|
||||
|
||||
$data = $response->json();
|
||||
|
||||
return [
|
||||
'name' => $data['displayName'] ?? $data['name'] ?? 'Unknown',
|
||||
'version' => $data['version'] ?? 'Unknown',
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Why "RV-Ready"?
|
||||
|
||||
This approach requires **zero ongoing maintenance**. As Technic updates their launcher versions, our extension automatically mimics the latest official launcher — no code changes needed.
|
||||
|
||||
---
|
||||
|
||||
## Key Endpoints
|
||||
|
||||
| Endpoint | Purpose |
|
||||
|----------|---------|
|
||||
| `https://api.technicpack.net/launcher/version/stable4` | Get current launcher build number |
|
||||
| `https://api.technicpack.net/modpack/{slug}?build={N}` | Get modpack info with valid build |
|
||||
|
||||
---
|
||||
|
||||
## Result
|
||||
|
||||
All 4 platforms now working:
|
||||
- ✅ Modrinth
|
||||
- ✅ FTB
|
||||
- ✅ CurseForge
|
||||
- ✅ Technic
|
||||
Reference in New Issue
Block a user