{"record":{"id":"259353293e333767","repo":"dromara/Sa-Token","slug":"client","errorCode":null,"errorMessage":"client 标识不可为空","messagePattern":"client 标识不可为空","errorType":"exception","errorClass":"SaSsoException","httpStatus":null,"severity":"error","filePath":"sa-token-plugin/sa-token-sso/src/main/java/cn/dev33/satoken/sso/template/SaSsoServerTemplate.java","lineNumber":299,"sourceCode":"     * @param client /\n     * @return /\n     */\n    public SaSsoClientModel getClient(String client) {\n        return getServerConfig().getClients().get(client);\n    }\n\n    /**\n     * 获取应用信息，无效 client 则抛出异常\n     *\n     * @param client /\n     * @return /\n     */\n    public SaSsoClientModel getClientNotNull(String client) {\n        if(SaFoxUtil.isEmpty(client)) {\n            if(getConfigOfAllowAnonClient()) {\n                return getAnonClient();\n            } else {\n                throw new SaSsoException(\"client 标识不可为空\");\n            }\n        } else {\n            SaSsoClientModel scm = getClient(client);\n            if(scm == null) {\n                throw new SaSsoException(\"未能获取应用信息，client=\" + client).setCode(SaSsoErrorCode.CODE_30013);\n            }\n            return scm;\n        }\n    }\n\n    /**\n     * 获取配置项：是否允许匿名 client 接入\n     *\n     * @return /\n     */\n    public boolean getConfigOfAllowAnonClient() {\n        return getServerConfig().getAllowAnonClient();\n    }","sourceCodeStart":281,"sourceCodeEnd":317,"githubUrl":"https://github.com/dromara/Sa-Token/blob/ac2c7f6e94a78573cf0bcb932dd8b04e68fad189/sa-token-plugin/sa-token-sso/src/main/java/cn/dev33/satoken/sso/template/SaSsoServerTemplate.java#L281-L317","documentation":"Thrown by SaSsoServerTemplate.getClientNotNull when the client parameter is empty and anonymous-client access is not enabled (allow-anon-client=false, the default). The server needs a client identifier to load the app's allow-url and sign-key configuration; without it and without the anon escape hatch, it refuses the request.","triggerScenarios":"A request to /sso/auth or a ticket/check call omits the client parameter while getAllowAnonClient() returns false.","commonSituations":"Older client apps or sa-token versions that never send a client parameter; a redirect URL that drops query parameters; server operator unaware that multi-client mode requires either per-request client ids or the anon switch.","solutions":["Have the client send its identifier (client query param / configured client id) on every SSO request","Or enable anonymous client access on the server: sa-token.sso.allow-anon-client=true, which substitutes a default anonymous client model"],"exampleFix":"# application.yml (sso-server)\n# before\nsa-token:\n  sso: {}\n\n# after\nsa-token:\n  sso:\n    allow-anon-client: true","handlingStrategy":"validation","validationCode":"String client = req.getParam(paramName.client);\nif(SaFoxUtil.isEmpty(client) && !cfg.getAllowAnonClient()) {\n    // reject early with a clear 400 instead of deep exception\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Send the client id on every SSO request from client apps","Set allow-anon-client=true only if you accept the looser model"],"tags":["sa-token","sso","config","client"],"backgroundTag":null,"analyzedSha":"ac2c7f6e94a78573cf0bcb932dd8b04e68fad189","analyzedAt":"2026-08-14T14:36:10.271Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}