{"record":{"id":"0ac583025b9c78a7","repo":"justauth/JustAuth","slug":"object-getstring-error-description-0ac583","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/AuthOschinaRequest.java","lineNumber":102,"sourceCode":"     * @param authToken 用户授权后的token\n     * @return 返回获取userInfo的url\n     */\n    @Override\n    protected String userInfoUrl(AuthToken authToken) {\n        return UrlBuilder.fromBaseUrl(source.userInfo())\n            .queryParam(\"access_token\", authToken.getAccessToken())\n            .queryParam(\"dataType\", \"json\")\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","sourceCodeStart":84,"sourceCodeEnd":106,"githubUrl":"https://github.com/justauth/JustAuth/blob/694bbf1b010d93404e3bfb4824d90e9ddfaebebb/src/main/java/me/zhyd/oauth/request/AuthOschinaRequest.java#L84-L106","documentation":"AuthOschinaRequest.checkResponse throws AuthException with 'error_description' when the OSChina (开源中国) API response contains an 'error' key. OSChina returns OAuth-style errors for invalid tokens or failed grants.","triggerScenarios":"getAccessToken, refresh, or getUserInfo on AuthOschinaRequest when OSChina responds with {\"error\":...,\"error_description\":...} — wrong client secret, invalid/expired authorization code, or a revoked access token.","commonSituations":"Note OSChina has deprecated/limited its OAuth service in recent years; developers hit this when the API endpoint is offline or the app registration is no longer active.","solutions":["Log error_description to see OSChina's stated reason","Verify clientId/clientSecret are still valid on OSChina's open platform","Start a fresh authorization round-trip for a new code","If OSChina has deprecated the API for your app, remove the source from your login options"],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"try {\n    oschinaRequest.getAuthResponse(callback);\n} catch (AuthException e) {\n    log.warn(\"OSChina error: {}\", e.getMessage());\n    // treat as provider outage; offer other login providers\n}","preventionTips":["Health-check OSChina OAuth before enabling the button (service is largely deprecated)","Keep alternative login providers configured so one dead IdP does not block login","Cache openid/uuid from earlier successful logins"],"tags":["oauth","oschina","deprecated-api","auth-exception"],"backgroundTag":null,"analyzedSha":"694bbf1b010d93404e3bfb4824d90e9ddfaebebb","analyzedAt":"2026-08-14T15:16:59.945Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}