{"record":{"id":"0b4a6ee686b5616d","repo":"justauth/JustAuth","slug":"object-getstring-error-description-0b4a6e","errorCode":null,"errorMessage":"object.getString(\"error_description\")","messagePattern":"object\\.getString\\(\"error_description\"\\)","errorType":"exception","errorClass":"AuthException","httpStatus":null,"severity":"error","filePath":"src/main/java/me/zhyd/oauth/request/AuthProginnRequest.java","lineNumber":81,"sourceCode":"            .uuid(object.getString(\"uid\"))\n            .username(object.getString(\"nickname\"))\n            .nickname(object.getString(\"nickname\"))\n            .avatar(object.getString(\"avatar\"))\n            .email(object.getString(\"email\"))\n            .gender(AuthUserGender.UNKNOWN)\n            .token(authToken)\n            .source(source.toString())\n            .build();\n    }\n\n    /**\n     * 检查响应内容是否正确\n     *\n     * @param object 请求响应内容\n     */\n    private void checkResponse(JSONObject object) {\n        if (object.containsKey(\"error\")) {\n            throw new AuthException(object.getString(\"error_description\"));\n        }\n    }\n\n    /**\n     * 返回带{@code state}参数的授权url，授权回调时会带上这个{@code state}\n     *\n     * @param state state 验证授权流程的参数，可以防止csrf\n     * @return 返回授权地址\n     */\n    @Override\n    public String authorize(String state) {\n        return UrlBuilder.fromBaseUrl(super.authorize(state))\n            .queryParam(\"scope\", this.getScopes(\" \", true, AuthScopeUtils.getDefaultScopes(AuthProginnScope.values())))\n            .build();\n    }\n}\n","sourceCodeStart":63,"sourceCodeEnd":98,"githubUrl":"https://github.com/justauth/JustAuth/blob/694bbf1b010d93404e3bfb4824d90e9ddfaebebb/src/main/java/me/zhyd/oauth/request/AuthProginnRequest.java#L63-L98","documentation":"AuthProginnRequest.checkResponse throws AuthException with 'error_description' when the Proginn (程序员客栈) API response contains an 'error' key — the standard OAuth2 error envelope for rejected grants or invalid tokens.","triggerScenarios":"Token exchange or userinfo calls when Proginn returns an error body: wrong client credentials, expired/used code, or unapproved app permissions.","commonSituations":"Misconfigured AuthConfig credentials, redirect URI not whitelisted on Proginn's open platform, or reusing a code after a double callback (browser prefetch hitting the callback URL twice).","solutions":["Read error_description from the caught AuthException for the exact reason","Guard the callback endpoint against double invocation (idempotent code exchange)","Verify clientId/clientSecret/redirectUri against Proginn's developer console","Restart the authorization flow for a fresh code"],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"try {\n    proginnRequest.getAuthResponse(callback);\n} catch (AuthException e) {\n    log.warn(\"Proginn error: {}\", e.getMessage());\n    return redirectToLoginWithError(\"proginn\");\n}","preventionTips":["Make the OAuth callback idempotent to prevent double code exchange","Verify Proginn developer console credentials and redirect whitelist","Always start with a fresh authorize round-trip after failures"],"tags":["oauth","proginn","invalid-grant","auth-exception"],"backgroundTag":null,"analyzedSha":"694bbf1b010d93404e3bfb4824d90e9ddfaebebb","analyzedAt":"2026-08-14T15:16:59.945Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}