{"record":{"id":"3b2d17acf6695ed7","repo":"justauth/JustAuth","slug":"object-getstring-m","errorCode":null,"errorMessage":"object.getString(\"m\")","messagePattern":"object\\.getString\\(\"m\"\\)","errorType":"exception","errorClass":"AuthException","httpStatus":null,"severity":"error","filePath":"src/main/java/me/zhyd/oauth/request/AuthKujialeRequest.java","lineNumber":82,"sourceCode":"\n    private JSONObject checkResponse(String response) {\n        JSONObject accessTokenObject = JSONObject.parseObject(response);\n        if (!\"0\".equals(accessTokenObject.getString(\"c\"))) {\n            throw new AuthException(accessTokenObject.getString(\"m\"));\n        }\n        return accessTokenObject;\n    }\n\n    @Override\n    public AuthUser getUserInfo(AuthToken authToken) {\n        String openId = this.getOpenId(authToken);\n        String response = new HttpUtils(config.getHttpConfig()).get(UrlBuilder.fromBaseUrl(source.userInfo())\n            .queryParam(\"access_token\", authToken.getAccessToken())\n            .queryParam(\"open_id\", openId)\n            .build()).getBody();\n        JSONObject object = JSONObject.parseObject(response);\n        if (!\"0\".equals(object.getString(\"c\"))) {\n            throw new AuthException(object.getString(\"m\"));\n        }\n        JSONObject resultObject = object.getJSONObject(\"d\");\n\n        return AuthUser.builder()\n            .rawUserInfo(resultObject)\n            .username(resultObject.getString(\"userName\"))\n            .nickname(resultObject.getString(\"userName\"))\n            .avatar(resultObject.getString(\"avatar\"))\n            .uuid(resultObject.getString(\"openId\"))\n            .token(authToken)\n            .source(source.toString())\n            .build();\n    }\n\n    /**\n     * 获取酷家乐的openId，此id在当前client范围内可以唯一识别授权用户\n     *\n     * @param authToken 通过{@link AuthKujialeRequest#getAccessToken(AuthCallback)}获取到的{@code authToken}","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/justauth/JustAuth/blob/694bbf1b010d93404e3bfb4824d90e9ddfaebebb/src/main/java/me/zhyd/oauth/request/AuthKujialeRequest.java#L64-L100","documentation":"Same {c,m,d} envelope check applied in AuthKujialeRequest.getUserInfo: if the user-info response code 'c' is not \"0\", JustAuth throws AuthException carrying the 'm' message. Unlike the token path, this fires while fetching the user profile with a supposedly valid token.","triggerScenarios":"Calling getUserInfo(authToken) when Kujiale rejects the access_token (expired or revoked), or when the open_id query param does not match the token.","commonSituations":"Token stored and reused past its expiresIn, revoked app authorization, or openId fetched from a different token/session.","solutions":["If 'm' indicates token expiry, call refresh (or re-authorize) before getUserInfo","Ensure the openId passed comes from the same authorization as the access token","Persist expiresIn and proactively refresh tokens before calling user info","Log and surface the Kujiale message for diagnosis"],"exampleFix":"null","handlingStrategy":"retry","validationCode":"long expiresAt = tokenStore.getIssuedAt() + token.getExpiresIn() * 1000L;\nif (System.currentTimeMillis() > expiresAt - 60_000L) {\n    token = kujialeRequest.refresh(token).getData(); // refresh before it expires\n}","typeGuard":"null","tryCatchPattern":"try {\n    return kujialeRequest.getUserInfo(token);\n} catch (AuthException e) {\n    token = kujialeRequest.refresh(token).getData();\n    return kujialeRequest.getUserInfo(token); // one retry with fresh token\n}","preventionTips":["Persist expiresIn at token acquisition time and schedule refresh","Retry user-info exactly once after refresh, then surface to re-login","Bind openId to the token that produced it"],"tags":["oauth","kujiale","token-expired","auth-exception"],"backgroundTag":null,"analyzedSha":"694bbf1b010d93404e3bfb4824d90e9ddfaebebb","analyzedAt":"2026-08-14T15:16:59.945Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}