paascloud/paascloud-master · error · UnapprovedClientAuthenticationException
clientId对应的配置信息不存在:
Error message
clientId对应的配置信息不存在:
What it means
UnapprovedClientAuthenticationException with message 'clientId对应的配置信息不存在:' + clientId thrown by UacUserLoginController.refreshToken when clientDetailsService.loadClientByClientId(clientId) returns null — the client id decoded from the Basic auth header has no registered OAuth2 ClientDetails record.
Solutions
- Register the client id in the OAuth client details store (insert into oauth_client_details or the UAC client management UI)
- Verify the clientId in the Basic auth header matches a registered client exactly (case-sensitive)
- Seed the correct client configuration in the target environment's database
- Check that clientDetailsService points at the right datasource/environment
Example fix
// before Authorization: Basic d3JvbmdDbGllbnQ6c2VjcmV0 // 'wrongClient' not registered // after Authorization: Basic cGFhc2Nsb3VkOnBhYXNjbG91ZA== // registered clientId:secret
Defensive patterns
Strategy: validation
Validate before calling
// confirm client is registered before calling
const registered = await fetchClientDetails(clientId); // or check oauth_client_details table
if (!registered) { failFast('clientId not registered: ' + clientId); } Try / catch
try { await refreshToken(token, headers); }
catch (e) {
if (String(e.message).includes('配置信息不存在')) {
// register the client or fix the clientId in config
}
} Prevention
- Keep client ids in environment-specific config, never hardcode
- Seed oauth_client_details in every environment via migration scripts
- Avoid typos: copy clientId from a single source of truth
- Verify datasource points to the environment you expect
When it happens
Trigger: POST to refreshToken with a Basic Authorization header whose decoded clientId does not exist in the OAuth client store (no row for that client_id in the client details table).
Common situations: Typo or case mismatch in the client id; client was deleted or not seeded in the target environment (DB not migrated); using a client id from another environment (dev client id against prod DB); database table oauth_client_details empty after a fresh install.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
AI-assisted analysis of paascloud/paascloud-master@781281a950 (2026-09-10).
Data as JSON: /api/errors/46b1bf52c560e3d8.
Report an issue: GitHub.
Appendix: source
Thrown at paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/web/admin/UacUserLoginController.java:120
public Wrapper<String> refreshToken(HttpServletRequest request, @RequestParam(value = "refreshToken") String refreshToken, @RequestParam(value = "accessToken") String accessToken) {
String token;
try {
Preconditions.checkArgument(org.apache.commons.lang3.StringUtils.isNotEmpty(accessToken), "accessToken is null");
Preconditions.checkArgument(org.apache.commons.lang3.StringUtils.isNotEmpty(refreshToken), "refreshToken is null");
String header = request.getHeader(HttpHeaders.AUTHORIZATION);
if (header == null || !header.startsWith(BEARER_TOKEN_TYPE)) {
throw new UnapprovedClientAuthenticationException("请求头中无client信息");
}
String[] tokens = RequestUtil.extractAndDecodeHeader(header);
assert tokens.length == 2;
String clientId = tokens[0];
String clientSecret = tokens[1];
ClientDetails clientDetails = clientDetailsService.loadClientByClientId(clientId);
if (clientDetails == null) {
throw new UnapprovedClientAuthenticationException("clientId对应的配置信息不存在:" + clientId);
} else if (!StringUtils.equals(clientDetails.getClientSecret(), clientSecret)) {
throw new UnapprovedClientAuthenticationException("clientSecret不匹配:" + clientId);
}
token = uacUserTokenService.refreshToken(accessToken, refreshToken, request);
} catch (Exception e) {
logger.error("refreshToken={}", e.getMessage(), e);
return WrapMapper.error();
}
return WrapMapper.ok(token);
}
}View on GitHub (pinned to 781281a950)