Hello.
I have a PHP-script and a callback-function to authenticate our system to the Nuki web api.
Until March 25, 2026 it worked fine and I got a Token.
Since then when I call the auth-init-script, I get from Nuki the site to confirm the user-rights for that request. And when I confirm, I get HTTP 500:
The server encountered an unexpected condition which prevented it from fulfilling the request
What could be the Problem?
I checked the callback-URI and created a new API-Token on the Nuki-Web-Api site. The error still remains.
nuki-auth-init.php:
// OAuth2-Autorisierungs-URL aufbauen
$params = http_build_query([
'response_type' => 'code',
'client_id' => NUKI_CLIENT_ID,
'redirect_uri' => NUKI_REDIRECT_URI,
'scope' => 'smartlock smartlock.auth',
'state' => bin2hex(random_bytes(16)),
]);
header('Location: https://api.nuki.io/oauth/authorize?' . $params);
exit;
nuki-callback.php
// Authorization-Code gegen Tokens tauschen
$ch = curl_init('https://api.nuki.io/oauth/token');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query([
'grant_type' => 'authorization_code',
'code' => $_GET['code'],
'redirect_uri' => NUKI_REDIRECT_URI,
'client_id' => NUKI_CLIENT_ID,
// Kein client_secret – Nuki ist ein Public Client
]),
CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if (empty($response['access_token'])) {
die('Fehler beim Token-Abruf (HTTP ' . $httpCode . '): ' . json_encode($response));
}