{"record":{"id":"9a56552c1ae47d6e","repo":"apolloconfig/apollo","slug":"unsupported-auth-type-s-9a5655","errorCode":null,"errorMessage":"Unsupported auth type: %s","messagePattern":"Unsupported auth type: (.+?)","errorType":"exception","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/v1/controller/OpenApiOperatorResolver.java","lineNumber":63,"sourceCode":"        || UserIdentityConstants.USER_TOKEN.equals(authType)) {\n      UserInfo loginUser = userInfoHolder.getUser();\n      if (loginUser == null || !StringUtils.hasText(loginUser.getUserId())) {\n        throw new BadRequestException(\"Current user not found\");\n      }\n      return loginUser.getUserId();\n    }\n\n    if (UserIdentityConstants.CONSUMER.equals(authType)) {\n      if (!StringUtils.hasText(operator)) {\n        throw new BadRequestException(\"operator should not be null or empty\");\n      }\n      if (userService.findByUserId(operator) == null) {\n        throw BadRequestException.userNotExists(operator);\n      }\n      return operator;\n    }\n\n    throw new BadRequestException(\"Unsupported auth type: %s\", authType);\n  }\n}\n","sourceCodeStart":45,"sourceCodeEnd":66,"githubUrl":"https://github.com/apolloconfig/apollo/blob/d95fc18d112589efc09ddcbe1507047584d55251/apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/v1/controller/OpenApiOperatorResolver.java#L45-L66","documentation":"HTTP 400 (BadRequestException). Thrown by OpenApiOperatorResolver.resolve when UserIdentityContextHolder.getAuthType() is not USER, USER_TOKEN, or CONSUMER (e.g. ANONYMOUS, null, or an unrecognized value). The resolver cannot determine how to obtain the operator. Same root cause as errors 85/93, centralized in the shared resolver.","triggerScenarios":"Any OpenAPI write endpoint delegating to OpenApiOperatorResolver when the request authenticated as ANONYMOUS or authType was never set in the security context.","commonSituations":"Endpoint left open to anonymous; security filter failed to populate UserIdentityContextHolder.authType; a new auth mechanism introduced without registering its constant; tests invoking the resolver without a context.","solutions":["Authenticate with a supported mechanism (portal SSO -> USER, user-token -> USER_TOKEN, OpenAPI token -> CONSUMER).","Fix the security filter chain to set authType for every authenticated request.","Reject anonymous/unknown authType before reaching the controller.","Ensure the constant matches exactly 'USER'/'USER_TOKEN'/'CONSUMER'."],"exampleFix":"// before: authType = ANONYMOUS -> 400\nresolver.resolve(\"alice\");\n\n// after: authenticate as CONSUMER\nclient.withConsumerToken(token).someWrite(operator=\"alice\");","handlingStrategy":"validation","validationCode":"// Ensure a recognized auth type before resolving the operator.\nString authType = UserIdentityContextHolder.getAuthType();\nif (!Set.of(\"USER\",\"USER_TOKEN\",\"CONSUMER\").contains(authType)) { /* authenticate */ }","typeGuard":"null","tryCatchPattern":"try {\n  client.someWrite(appId, payload);\n} catch (HttpClientErrorException.BadRequest e) {\n  if (e.getResponseBodyAsString().contains(\"Unsupported auth type\")) {\n    // authenticate with a supported mechanism and retry\n  }\n}","preventionTips":["Authenticate every write as USER, USER_TOKEN, or CONSUMER.","Reject anonymous/unknown authType in the filter chain.","Keep auth-type constants aligned across integrations."],"tags":["apollo-portal","openapi","auth","bad-request","operator","anonymous","resolver"],"backgroundTag":null,"analyzedSha":"d95fc18d112589efc09ddcbe1507047584d55251","analyzedAt":"2026-08-14T04:00:05.477Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}