{"record":{"id":"0956bd919bc08b1a","repo":"justauth/JustAuth","slug":"5014","errorCode":"5014","errorMessage":"Invalid client id","messagePattern":"Invalid client id","errorType":"exception","errorClass":"AuthException","httpStatus":null,"severity":"error","filePath":"src/main/java/me/zhyd/oauth/request/AuthAppleRequest.java","lineNumber":99,"sourceCode":"        String[] idToken = authToken.getIdToken().split(\"\\\\.\");\n        String payload = new String(urlDecoder.decode(idToken[1]));\n        JSONObject object = JSONObject.parseObject(payload);\n        // https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_rest_api/authenticating_users_with_sign_in_with_apple#3383773\n        return AuthUser.builder()\n            .rawUserInfo(object)\n            .uuid(object.getString(\"sub\"))\n            .email(object.getString(\"email\"))\n            .username(authToken.getUsername())\n            .token(authToken)\n            .source(source.toString())\n            .build();\n    }\n\n    @Override\n    protected void checkConfig(AuthConfig config) {\n        super.checkConfig(config);\n        if (StringUtils.isEmpty(config.getClientId())) {\n            throw new AuthException(AuthResponseStatus.ILLEGAL_CLIENT_ID, source);\n        }\n        if (StringUtils.isEmpty(config.getClientSecret())) {\n            throw new AuthException(AuthResponseStatus.ILLEGAL_CLIENT_SECRET, source);\n        }\n        if (StringUtils.isEmpty(config.getKid())) {\n            throw new AuthException(AuthResponseStatus.ILLEGAL_KID, source);\n        }\n        if (StringUtils.isEmpty(config.getTeamId())) {\n            throw new AuthException(AuthResponseStatus.ILLEGAL_TEAM_ID, source);\n        }\n    }\n\n    /**\n     * 获取token\n     * @see <a href=\"https://developer.apple.com/documentation/accountorganizationaldatasharing/creating-a-client-secret\">creating-a-client-secret</a>\n     * @return jwt token\n     */\n    private String getToken() {","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/justauth/JustAuth/blob/694bbf1b010d93404e3bfb4824d90e9ddfaebebb/src/main/java/me/zhyd/oauth/request/AuthAppleRequest.java#L81-L117","documentation":"AuthException with AuthResponseStatus.ILLEGAL_CLIENT_ID (code 5014) from AuthAppleRequest.checkConfig: after the base config check, config.getClientId() is empty. For Apple, clientId must be the Services ID (e.g. com.yourapp.auth), not the App ID or team id.","triggerScenarios":"Instantiating AuthAppleRequest (directly or via AuthRequestBuilder with source APPLE) with an AuthConfig lacking clientId. checkConfig runs at construction, so the request never reaches Apple.","commonSituations":"Confusing Apple's identifiers: using the App ID/bundle id or team id where the Services ID belongs; placeholder config promoted to production; clientId read from an env var unset in the deploy environment.","solutions":["Set clientId to the Sign in with Apple Services ID created in the developer console","While configuring, also set kid (key id), teamId and the .p8 private key as clientSecret — the same check enforces them next","Log AuthConfig completeness at startup for the APPLE source to fail fast"],"exampleFix":"// before\nAuthConfig.builder().redirectUri(\"https://x/callback\").build();\n\n// after\nAuthConfig.builder()\n    .clientId(\"com.yourapp.auth\")      // Services ID\n    .clientSecret(\"-----BEGIN PRIVATE KEY-----...\") // .p8 content\n    .kid(\"ABC123DEFG\")\n    .teamId(\"WXYZ1234AB\")\n    .redirectUri(\"https://x/callback\").build();","handlingStrategy":"validation","validationCode":"if (StringUtils.isEmpty(config.getClientId())\n    || StringUtils.isEmpty(config.getClientSecret())\n    || StringUtils.isEmpty(config.getKid())\n    || StringUtils.isEmpty(config.getTeamId())) {\n    throw new IllegalStateException(\"APPLE requires clientId(Services ID), clientSecret(.p8 PEM), kid, teamId\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the Services ID (com.yourapp.auth), not the bundle/App ID","Keep all four Apple config fields as one atomic unit in config management","Add a startup config check per provider"],"tags":["apple","config","validation","services-id"],"backgroundTag":null,"analyzedSha":"694bbf1b010d93404e3bfb4824d90e9ddfaebebb","analyzedAt":"2026-08-14T15:16:59.945Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}