{"record":{"id":"4f617965c3f6929a","repo":"justauth/JustAuth","slug":"5002-4f6179","errorCode":"5002","errorMessage":"Parameter incomplete","messagePattern":"Parameter incomplete","errorType":"exception","errorClass":"AuthException","httpStatus":null,"severity":"error","filePath":"src/main/java/me/zhyd/oauth/request/AuthDefaultRequest.java","lineNumber":40,"sourceCode":" * @author yadong.zhang (yadong.zhang0415(a)gmail.com)\n * @author yangkai.shen (https://xkcoding.com)\n * @since 1.0.0\n */\npublic abstract class AuthDefaultRequest implements AuthRequest {\n    protected AuthConfig config;\n    protected AuthSource source;\n    protected AuthStateCache authStateCache;\n\n    public AuthDefaultRequest(AuthConfig config, AuthSource source) {\n        this(config, source, AuthDefaultStateCache.INSTANCE);\n    }\n\n    public AuthDefaultRequest(AuthConfig config, AuthSource source, AuthStateCache authStateCache) {\n        this.config = config;\n        this.source = source;\n        this.authStateCache = authStateCache;\n        if (!AuthChecker.isSupportedAuth(config, source)) {\n            throw new AuthException(AuthResponseStatus.PARAMETER_INCOMPLETE, source);\n        }\n        // 校验配置合法性\n        this.checkConfig(config);\n    }\n\n    /**\n     * 统一的登录入口。当通过{@link AuthDefaultRequest#authorize(String)}授权成功后，会跳转到调用方的相关回调方法中\n     * 方法的入参可以使用{@code AuthCallback}，{@code AuthCallback}类中封装好了OAuth2授权回调所需要的参数\n     *\n     * @param authCallback 用于接收回调参数的实体\n     * @return AuthResponse\n     */\n    @Override\n    public AuthResponse<AuthUser> login(AuthCallback authCallback) {\n        try {\n            checkCode(authCallback);\n            if (!config.isIgnoreCheckState()) {\n                AuthChecker.checkState(authCallback.getState(), source, authStateCache);","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/justauth/JustAuth/blob/694bbf1b010d93404e3bfb4824d90e9ddfaebebb/src/main/java/me/zhyd/oauth/request/AuthDefaultRequest.java#L22-L58","documentation":"This is a local configuration failure thrown from the AuthDefaultRequest constructor (AuthDefaultRequest.java:40): before any network call, JustAuth runs AuthChecker.isSupportedAuth(config, source) and rejects the request with code 5002 (PARAMETER_INCOMPLETE) when the AuthConfig is missing fields the given provider requires (typically clientId, clientSecret, redirectUri). It is thrown synchronously at object construction time.","triggerScenarios":"Constructing any AuthXxxRequest (e.g. new AuthBaiduRequest(config, AuthDefaultSource.BAIDU)) where config.getClientId(), getClientSecret() or getRedirectUri() is null/blank; also when a custom AuthSource does not declare required endpoints.","commonSituations":"Loading OAuth credentials from environment variables or a properties file that is empty in a deployed environment, forgetting to call builder methods on AuthConfig, or injecting an autowired AuthConfig bean whose fields were never populated in the active Spring profile.","solutions":["Populate all required AuthConfig fields: AuthConfig.builder().clientId(..).clientSecret(..).redirectUri(..).build().","If config comes from env/properties, fail startup fast with a clear message when any of the three values is blank.","For custom AuthSource implementations, make sure authorize/accessToken/userInfo/refresh URLs are all set - AuthChecker also validates the source's endpoint definitions.","Catch AuthException around request construction and check ErrorCodeEnum.fromCode(5002) to distinguish config errors from API errors."],"exampleFix":"// before\nAuthConfig config = AuthConfig.builder().clientId(clientId).build(); // secret + redirectUri missing\nAuthRequest request = new AuthBaiduRequest(config, AuthDefaultSource.BAIDU); // throws 5002\n\n// after\nAuthConfig config = AuthConfig.builder()\n    .clientId(clientId)\n    .clientSecret(clientSecret)\n    .redirectUri(redirectUri)\n    .build();\nAuthRequest request = new AuthBaiduRequest(config, AuthDefaultSource.BAIDU);","handlingStrategy":"validation","validationCode":"// Validate before constructing any AuthRequest\npublic AuthConfig requireValidConfig(String clientId, String clientSecret, String redirectUri) {\n    if (isBlank(clientId) || isBlank(clientSecret) || isBlank(redirectUri)) {\n        throw new IllegalStateException(\"OAuth config incomplete: clientId/clientSecret/redirectUri must all be set\");\n    }\n    return AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build();\n}","typeGuard":null,"tryCatchPattern":"try {\n    return new AuthBaiduRequest(config, AuthDefaultSource.BAIDU);\n} catch (AuthException e) {\n    if (e.getErrorCode() == 5002) {\n        throw new ConfigurationException(\"OAuth provider config incomplete - check env vars\", e);\n    }\n    throw e;\n}","preventionTips":["Fail fast at application startup: assert all OAuth config fields are present before serving traffic.","Use a startup checklist per environment (dev/staging/prod) so missing env vars are caught by health checks, not user logins.","Add a config unit test that builds every AuthRequest you use - it will throw 5002 immediately if a field is missing."],"tags":["oauth","justauth","configuration","fail-fast","auth-exception"],"backgroundTag":null,"analyzedSha":"694bbf1b010d93404e3bfb4824d90e9ddfaebebb","analyzedAt":"2026-08-14T15:16:59.945Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}