{"record":{"id":"ec0f1b56642f4dac","repo":"justauth/JustAuth","slug":"5005","errorCode":"5005","errorMessage":"Unidentified platform","messagePattern":"Unidentified platform","errorType":"exception","errorClass":"AuthException","httpStatus":null,"severity":"error","filePath":"src/main/java/me/zhyd/oauth/request/AbstractAuthWeChatEnterpriseRequest.java","lineNumber":56,"sourceCode":"        String response = doGetAuthorizationCode(accessTokenUrl(null));\n\n        JSONObject object = this.checkResponse(response);\n\n        return AuthToken.builder()\n            .accessToken(object.getString(\"access_token\"))\n            .expireIn(object.getIntValue(\"expires_in\"))\n            .code(authCallback.getCode())\n            .build();\n    }\n\n    @Override\n    public AuthUser getUserInfo(AuthToken authToken) {\n        String response = doGetUserInfo(authToken);\n        JSONObject object = this.checkResponse(response);\n\n        // 返回 OpenId 或其他，均代表非当前企业用户，不支持\n        if (!object.containsKey(\"UserId\")) {\n            throw new AuthException(AuthResponseStatus.UNIDENTIFIED_PLATFORM, source);\n        }\n        String userId = object.getString(\"UserId\");\n        String userTicket = object.getString(\"user_ticket\");\n        JSONObject userDetail = getUserDetail(authToken.getAccessToken(), userId, userTicket);\n\n        return AuthUser.builder()\n            .rawUserInfo(userDetail)\n            .username(userDetail.getString(\"name\"))\n            .nickname(userDetail.getString(\"alias\"))\n            .avatar(userDetail.getString(\"avatar\"))\n            .location(userDetail.getString(\"address\"))\n            .email(userDetail.getString(\"email\"))\n            .uuid(userId)\n            .gender(AuthUserGender.getWechatRealGender(userDetail.getString(\"gender\")))\n            .token(authToken)\n            .source(source.toString())\n            .build();\n    }","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/justauth/JustAuth/blob/694bbf1b010d93404e3bfb4824d90e9ddfaebebb/src/main/java/me/zhyd/oauth/request/AbstractAuthWeChatEnterpriseRequest.java#L38-L74","documentation":"AbstractAuthWeChatEnterpriseRequest.getUserInfo calls the WeChat Work (企业微信) user-info endpoint and checks for the UserId key. If the response has no UserId, the authenticated user does not belong to the configured enterprise/corp (or is following via a different scope), and the library throws AuthException 5005 (Unidentified platform) with the source attached.","triggerScenarios":"A WeChat user outside the corp scans the QR code (the API returns OpenId only, no UserId); wrong corpId/agentId in AuthConfig so membership lookup resolves to a different enterprise; using a self-built app token against users of another tenant.","commonSituations":"Public-facing login pages using the enterprise (WeChat Work) source by mistake — external users will never have UserId; copying agentId from one corp and corpId from another; testing with a personal WeChat account that has not joined the enterprise.","solutions":["Verify the user actually belongs to the corp: log in with a member of the enterprise tied to corpId/agentId in AuthConfig.","Double-check corpId and agentId (and secret) all come from the same WeChat Work app; mismatched IDs produce OpenId-only responses.","If you need public WeChat login (non-corp users), switch to the WECHAT_MOBILE or WECHAT_OPEN web sources instead of WECHAT_ENTERPRISE.","Treat 5005 as a business signal: prompt 'please use your enterprise account' rather than a system error."],"exampleFix":"// before\n// public login page uses WECHAT_ENTERPRISE source; external users -> 5005\n\n// after\ntry { return request.login(callback); }\ncatch (AuthException e) {\n    if (e.getErrcode() == AuthResponseStatus.UNIDENTIFIED_PLATFORM.getCode()) {\n        return Response.error(\"Please sign in with your enterprise WeChat account\");\n    }\n    throw e;\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { return request.login(callback); } catch (AuthException e) { if (e.getErrcode() == AuthResponseStatus.UNIDENTIFIED_PLATFORM.getCode()) { return respond(\"sign in with your enterprise WeChat account\"); } throw e; }","preventionTips":["Use WECHAT_ENTERPRISE only for corp-member login; use public WeChat sources for consumer login.","Verify corpId, agentId and secret all belong to the same self-built app.","Treat 5005 as a business rule (non-member), not a system failure."],"tags":["justauth","wechat-work","enterprise","membership","config"],"backgroundTag":null,"analyzedSha":"694bbf1b010d93404e3bfb4824d90e9ddfaebebb","analyzedAt":"2026-08-14T15:16:59.945Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}