{"record":{"id":"a233b0c284e58c3d","repo":"paascloud/paascloud-master","slug":"clientid","errorCode":null,"errorMessage":"clientId对应的配置信息不存在:","messagePattern":"clientId对应的配置信息不存在:","errorType":"http","errorClass":"UnapprovedClientAuthenticationException","httpStatus":401,"severity":"error","filePath":"paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/security/PcAuthenticationSuccessHandler.java","lineNumber":68,"sourceCode":"\n\t\tlogger.info(\"登录成功\");\n\n\t\tString header = request.getHeader(HttpHeaders.AUTHORIZATION);\n\n\t\tif (header == null || !header.startsWith(BEARER_TOKEN_TYPE)) {\n\t\t\tthrow new UnapprovedClientAuthenticationException(\"请求头中无client信息\");\n\t\t}\n\n\t\tString[] tokens = RequestUtil.extractAndDecodeHeader(header);\n\t\tassert tokens.length == 2;\n\n\t\tString clientId = tokens[0];\n\t\tString clientSecret = tokens[1];\n\n\t\tClientDetails clientDetails = clientDetailsService.loadClientByClientId(clientId);\n\n\t\tif (clientDetails == null) {\n\t\t\tthrow new UnapprovedClientAuthenticationException(\"clientId对应的配置信息不存在:\" + clientId);\n\t\t} else if (!StringUtils.equals(clientDetails.getClientSecret(), clientSecret)) {\n\t\t\tthrow new UnapprovedClientAuthenticationException(\"clientSecret不匹配:\" + clientId);\n\t\t}\n\n\t\tTokenRequest tokenRequest = new TokenRequest(MapUtils.EMPTY_MAP, clientId, clientDetails.getScope(), \"custom\");\n\n\t\tOAuth2Request oAuth2Request = tokenRequest.createOAuth2Request(clientDetails);\n\n\t\tOAuth2Authentication oAuth2Authentication = new OAuth2Authentication(oAuth2Request, authentication);\n\n\t\tOAuth2AccessToken token = authorizationServerTokenServices.createAccessToken(oAuth2Authentication);\n\t\tSecurityUser principal = (SecurityUser) authentication.getPrincipal();\n\t\tuacUserService.handlerLoginData(token, principal, request);\n\n\t\tlog.info(\"用户【 {} 】记录登录日志\", principal.getUsername());\n\n\t\tresponse.setContentType(\"application/json;charset=UTF-8\");\n\t\tresponse.getWriter().write((objectMapper.writeValueAsString(WrapMapper.ok(token))));","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/paascloud/paascloud-master/blob/781281a9503332ed3cef44ea618349d14230a127/paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/security/PcAuthenticationSuccessHandler.java#L50-L86","documentation":"Thrown by PcAuthenticationSuccessHandler.onAuthenticationSuccess when clientDetailsService.loadClientByClientId(clientId) returns null, i.e. no ClientDetails are registered for the clientId decoded from the Authorization header. Message is \"clientId对应的配置信息不存在:\" concatenated with the offending clientId.","triggerScenarios":"Login request carries an Authorization header with base64 credentials whose clientId part does not exist in the OAuth2 client store (uac_oauth_client_details table / in-memory client config).","commonSituations":"Typo in clientId; client row deleted or never inserted in the database; client registered in a different environment (dev vs prod DB); in-memory client list changed after a config refactor.","solutions":["Check the decoded clientId from the Authorization header for typos","Insert/verify a row in uac_oauth_client_details with the matching client_id","Confirm the service points at the correct database/environment where the client is registered","If using in-memory clients, add the clientId to the ClientDetailsService configuration"],"exampleFix":"// before\nAuthorization: Basic d3JvbmdDbGllbnQ6c2VjcmV0   // clientId 'wrongClient' not registered\n// after (register then use)\nINSERT INTO uac_oauth_client_details(client_id, client_secret, scope, ...) VALUES('paascloud-client', '{cipher}secret', 'all', ...);","handlingStrategy":"validation","validationCode":"boolean clientRegistered = clientDetailsService.loadClientByClientId(myClientId) != null; // or SELECT COUNT(*) FROM uac_oauth_client_details WHERE client_id = ?","typeGuard":null,"tryCatchPattern":"try { return authClient.login(user, pwd); } catch (UnapprovedClientAuthenticationException e) { if (e.getMessage().contains(\"配置信息不存在\")) { /* fix clientId registration */ } throw e; }","preventionTips":["Keep client registration SQL in migration scripts so every environment has the clients","Store clientId/clientSecret in per-environment config, never hardcode","Validate the clientId at application startup with a probe call","Log the clientId (not the secret) on auth failures for quick diagnosis"],"tags":["oauth2","client-registration","authentication","security"],"backgroundTag":"resource-not-found","analyzedSha":"781281a9503332ed3cef44ea618349d14230a127","analyzedAt":"2026-09-10T10:59:02.070Z","contentChangedAt":"2026-09-10T10:59:02.070Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}