Leantime/leantime · error · RuntimeException
Failed to retrieve tokens:
Error message
Failed to retrieve tokens:
What it means
Error "Failed to retrieve tokens: " thrown in Leantime/leantime.
Source
Thrown at app/Domain/Oidc/Services/Oidc.php:347
/**
* @throws GuzzleException
*/
private function requestTokens(string $code): array|string
{
$httpClient = Http::withoutVerifying();
// Add proper client authentication headers
$response = $httpClient->asForm()->post($this->getTokenUrl(), [
'client_id' => $this->clientId,
'client_secret' => $this->clientSecret,
'grant_type' => 'authorization_code',
'code' => $code,
'redirect_uri' => $this->buildRedirectUrl(),
]);
if ($response->failed()) {
Log::error('OIDC Token Request Failed: '.$response->body());
throw new \RuntimeException('Failed to retrieve tokens: '.$response->body());
}
$headerArray = [];
foreach ($response->getHeaders() as $header => $values) {
$headerArray[strtolower($header)] = $values;
}
$contentType = array_pop($headerArray['content-type']);
switch ($contentType) {
case 'application/x-www-form-urlencoded; charset=utf-8':
case 'application/x-www-form-urlencoded':
$result = [];
parse_str($response->getBody()->getContents(), $result);
return $result;
default:
return json_decode($response->getBody()->getContents(), true);
}View on GitHub (pinned to 9a9f49f100)
When it happens
Trigger: Thrown at app/Domain/Oidc/Services/Oidc.php:347 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Leantime/leantime@9a9f49f100 (2026-08-21).
Data as JSON: /api/errors/f31e083693e9fcef.
Report an issue: GitHub.