dromara/Sa-Token · warning · ApiDisabledException

CODE_30304

CODE_30304

Error message

jwt cannot get token list

What it means

ApiDisabledException from SaTempTemplateForJwt.getTempTokenList: listing the temp tokens issued for a value requires enumeration over stored tokens, which a stateless JWT implementation cannot provide. The API exists on the base template but is intentionally unimplemented here.

Source

Thrown at sa-token-plugin/sa-token-temp-jwt/src/main/java/cn/dev33/satoken/temp/jwt/SaTempTemplateForJwt.java:73

	public long getTimeout(String token) {
		return SaJwtUtil.getTimeout(token, getJwtSecretKey());
	}

	/**
	 * 删除一个token
	 */
	@Override
	public void deleteToken(String token) {
		throw new ApiDisabledException("jwt cannot delete token").setCode(SaTempJwtErrorCode.CODE_30302);
	}

	/**
	 * 获取指定 value 的 temp-token 列表记录
	 * @param value /
	 * @return /
	 */
	public List<String> getTempTokenList(Object value) {
		throw new ApiDisabledException("jwt cannot get token list").setCode(SaTempJwtErrorCode.CODE_30304);
	}

	/**
	 * 获取jwt秘钥 
	 * @return jwt秘钥 
	 */
	@Override
	public String getJwtSecretKey() {
		String jwtSecretKey = SaManager.getConfig().getJwtSecretKey();
		if(SaFoxUtil.isEmpty(jwtSecretKey)) {
			throw new SaTokenException("请配置:jwtSecretKey").setCode(SaTempJwtErrorCode.CODE_30301);
		}
		return jwtSecretKey;
	}
	
}

View on GitHub (pinned to ac2c7f6e94)

Solutions

  1. Drop the listing feature for JWT temp tokens — track issued tokens in your own table if you need an audit trail
  2. Switch to the storage-backed temp implementation if enumeration is a firm requirement
Defensive patterns

Strategy: type-guard

Type guard

boolean supportsListing = !(SaManager.getSaTempTemplate() instanceof SaTempTemplateForJwt);

Try / catch

try { temp.getTempTokenList(v); } catch (ApiDisabledException e) { /* listing unsupported for jwt: skip feature */ }

Prevention

When it happens

Trigger: Calling getTempTokenList(value) (directly or via admin/audit code) while the JWT temp-token template is bound as the SaTempTemplate implementation.

Common situations: Porting management/monitoring features that worked with the Redis-backed temp token to a deployment using sa-token-temp-jwt.

Related errors


AI-assisted analysis of dromara/Sa-Token@ac2c7f6e94 (2026-08-14). Data as JSON: /api/errors/788ae8b3e487b8e4. Report an issue: GitHub.