lots of progress
This commit is contained in:
@@ -9,7 +9,7 @@ use Illuminate\Support\Facades\Log;
|
||||
class IgdbAuthService
|
||||
{
|
||||
private const TOKEN_CACHE_KEY = 'igdb_access_token';
|
||||
private const TOKEN_EXPIRY = 3600; // 1 hour in seconds
|
||||
private const TOKEN_EXPIRY = 3600*24*31; // 1 month in seconds
|
||||
|
||||
public function getAccessToken(): string
|
||||
{
|
||||
@@ -21,13 +21,30 @@ class IgdbAuthService
|
||||
private function fetchNewAccessToken(): string
|
||||
{
|
||||
try {
|
||||
$response = Http::post('https://id.twitch.tv/oauth2/token', [
|
||||
'client_id' => config('services.igdb.client_id'),
|
||||
'client_secret' => config('services.igdb.client_secret'),
|
||||
// Log the config values to debug
|
||||
Log::info('IGDB Auth Attempt', [
|
||||
'client_id' => config('services.igdb.credentials.client_id'),
|
||||
'client_secret' => config('services.igdb.credentials.client_secret')
|
||||
]);
|
||||
|
||||
$clientId = config('igdb.credentials.client_id');
|
||||
$clientSecret = config('igdb.credentials.client_secret');
|
||||
|
||||
if (empty($clientId) || empty($clientSecret)) {
|
||||
throw new \Exception("IGDB credentials are not properly configured");
|
||||
}
|
||||
|
||||
$response = Http::asForm()->post('https://id.twitch.tv/oauth2/token', [
|
||||
'client_id' => $clientId,
|
||||
'client_secret' => $clientSecret,
|
||||
'grant_type' => 'client_credentials',
|
||||
]);
|
||||
|
||||
if (!$response->successful()) {
|
||||
Log::error('IGDB Auth Response', [
|
||||
'status' => $response->status(),
|
||||
'body' => $response->body()
|
||||
]);
|
||||
throw new \Exception("Failed to get access token: " . $response->body());
|
||||
}
|
||||
|
||||
@@ -40,4 +57,4 @@ class IgdbAuthService
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user