{"record":{"id":"7d3ce321a8af6e63","repo":"passbolt/passbolt_api","slug":"the-authentication-failed-the-credentials-are-missing","errorCode":null,"errorMessage":"The authentication failed. The credentials are missing.","messagePattern":"The authentication failed\\. The credentials are missing\\.","errorType":"exception","errorClass":"Cake\\Http\\Exception\\BadRequestException","httpStatus":400,"severity":"error","filePath":"plugins/PassboltCe/JwtAuthentication/src/Controller/JwtLoginController.php","lineNumber":74,"sourceCode":"        }\n\n        $result = $this->Authentication->getResult();\n        if ($result->isValid()) {\n            $challenge = $result->getData()['challenge'];\n            $user = $result->getData()['user'];\n            $uac = new UserAccessControl($user['role']['name'], $user['id']);\n            UserAction::getInstance()->setUserAccessControl($uac);\n\n            $event = new Event(UpdateUserLastLoggedInListener::EVENT_USER_LOGIN_SUCCESS, $this, ['user' => $user]);\n            $this->getEventManager()->dispatch($event);\n\n            $this->success(__('The authentication was a success.'), compact('challenge'));\n        } else {\n            $message = __('The authentication failed.') . ' ';\n            switch ($result->getStatus()) {\n                case Result::FAILURE_CREDENTIALS_MISSING:\n                    $message .= __('The credentials are missing.');\n                    throw new BadRequestException($message);\n                case Result::FAILURE_IDENTITY_NOT_FOUND:\n                    $message = __('The user does not exist or is not active or has been deleted.');\n                    throw new NotFoundException($message);\n                case Result::FAILURE_CREDENTIALS_INVALID:\n                    $message = __('The credentials are invalid.');\n                    throw new BadRequestException($message);\n                default:\n                case Result::FAILURE_OTHER:\n                    $message = __('An internal error occurred.');\n                    throw new InternalErrorException($message);\n            }\n        }\n    }\n}\n","sourceCodeStart":56,"sourceCodeEnd":89,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltCe/JwtAuthentication/src/Controller/JwtLoginController.php#L56-L89","documentation":"Thrown by JwtLoginController::loginPost when the authentication result status is FAILURE_CREDENTIALS_MISSING, meaning the authenticator found no credentials to verify at all (HTTP 400). The full message is 'The authentication failed. The credentials are missing.'","triggerScenarios":"POST /auth/jwt/login where the request body/headers contain no recognizable GPG challenge token, so the GpgJwtAuthenticator has nothing to authenticate.","commonSituations":"Client sent an empty or malformed JSON body; missing X-GPGAuth-* headers on stage 1 of the login; sending the token in the wrong field; skipping the server-verification step and posting directly.","solutions":["Include a valid GPGAuth challenge token in the request (headers/body as the client protocol requires)","Complete the GPGAuth handshake stages in order (verify server, then login)","Inspect the request body actually received server-side for missing fields","Compare against a working passbolt CLI request to spot the missing credential field"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (!challengeToken || !Object.keys(gpgAuthHeaders).length) throw new Error('refusing to call login: no GPGAuth credentials assembled');","typeGuard":null,"tryCatchPattern":"try { await login(token); } catch (e) { if (String(e.message).includes('credentials are missing')) { restartGpgAuthHandshake(); } }","preventionTips":["Complete the GPGAuth handshake stages in order before posting the login","Log outgoing headers/body in a debug mode to confirm the token is present","Reuse the protocol implementation from the official client"],"tags":["authentication","credentials","bad-request","gpg"],"backgroundTag":"missing-credentials","analyzedSha":"31c1bbc10f32808a607fa9bd81891e898779c0bc","analyzedAt":"2026-09-17T00:04:38.960Z","contentChangedAt":"2026-09-17T00:04:38.960Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}