{"record":{"id":"4e3dae174df3465f","repo":"justauth/JustAuth","slug":"jsonobject-getstring-message","errorCode":null,"errorMessage":"jsonObject.getString(\"message\")","messagePattern":"jsonObject\\.getString\\(\"message\"\\)","errorType":"exception","errorClass":"AuthException","httpStatus":null,"severity":"error","filePath":"src/main/java/me/zhyd/oauth/request/AuthFeishuRequest.java","lineNumber":145,"sourceCode":"\n    @Override\n    public String authorize(String state) {\n        return UrlBuilder.fromBaseUrl(source.authorize())\n            .queryParam(\"app_id\", config.getClientId())\n            .queryParam(\"redirect_uri\", GlobalAuthUtils.urlEncode(config.getRedirectUri()))\n            .queryParam(\"state\", getRealState(state))\n            .build();\n    }\n\n\n    /**\n     * 校验响应内容是否正确\n     *\n     * @param jsonObject 响应内容\n     */\n    private void checkResponse(JSONObject jsonObject) {\n        if (jsonObject.getIntValue(\"code\") != 0) {\n            throw new AuthException(jsonObject.getString(\"message\"));\n        }\n    }\n\n}\n","sourceCodeStart":127,"sourceCodeEnd":150,"githubUrl":"https://github.com/justauth/JustAuth/blob/694bbf1b010d93404e3bfb4824d90e9ddfaebebb/src/main/java/me/zhyd/oauth/request/AuthFeishuRequest.java#L127-L150","documentation":"AuthFeishuRequest.checkResponse() treats any response whose top-level 'code' is not 0 as a failure and throws AuthException with the 'message' field - Feishu/Lark's standard envelope is {code, msg/message}. It runs after token, refresh, and user-info calls.","triggerScenarios":"Token exchange or getUserInfo() when Feishu returns non-zero code: invalid app_id/app_secret, an unregistered redirect URI, an expired one-time code, or the app missing the required scopes (e.g. 'contact:user.base:readonly' for user info).","commonSituations":"Redirect URL domain not added to Feishu's web app security settings; credentials from a different Feishu app (custom app vs store app); or calling user info without applying for the corresponding API permission/scope.","solutions":["Add the exact redirect URI domain to the Feishu app's 'Security Settings > Redirect URLs' list.","Verify app_id/app_secret belong to the same Feishu app and it is enabled for web login.","Apply for and approve the user-info scope in the app's permission settings, then re-authorize so the new scope is granted.","Catch AuthException and log the 'message' text - Feishu messages (e.g. 'app secret is invalid') state the cause directly."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    return feishuRequest.getAccessToken(callback);\n} catch (AuthException e) {\n    log.warn(\"Feishu error: {}\", e.getErrorMsg());\n    if (String.valueOf(e.getErrorMsg()).contains(\"redirect\")) {\n        throw new ConfigurationException(\"Feishu redirect URL not registered in app security settings\", e);\n    }\n    throw e;\n}","preventionTips":["Register the redirect URL domain in the Feishu app's security settings before going live.","Request and approve the exact scopes (contact:user.base:readonly etc.) your userinfo call needs, then re-authorize.","Keep app_id/app_secret per environment and never mix custom-app and store-app credentials."],"tags":["oauth","feishu","lark","justauth","api-error","redirect-uri"],"backgroundTag":null,"analyzedSha":"694bbf1b010d93404e3bfb4824d90e9ddfaebebb","analyzedAt":"2026-08-14T15:16:59.945Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}