📣 极限科技诚招搜索运维工程师(Elasticsearch/Easysearch)- 全职/北京 👉 : 立即申请加入

版本: 7.7-8.9

简要来说,当在Elasticsearch的OAuth2认证过程中使用了不受支持的授权类型时,就会发生此错误。授权类型是一个参数,用于定义获取访问令牌所使用的方法。要解决此问题,请确保你使用的是受支持的授权类型,例如’password'、‘client_credentials’、‘refresh_token’或’authorization_code’。同时,请检查你的Elasticsearch版本,因为某些授权类型可能在旧版本中不受支持。

日志上下文 #

日志"the grant type [{}] is not supported"的类名是 TransportGrantAction.java。 我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入背景的人参考:

try (ThreadContext.StoredContext ignore = threadContext.stashContext()) {
 final AuthenticationToken authenticationToken = request.getGrant().getAuthenticationToken();
 assert authenticationToken != null : "authentication token must not be null";
 if (authenticationToken == null) {
 listener.onFailure(
 new ElasticsearchSecurityException("the grant type [{}] is not supported"; request.getGrant().getType())
 );
 return;
 }  final String runAsUsername = request.getGrant().getRunAsUsername();