The grant type is not supported – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 7.7-8.9

Briefly, this error occurs when an unsupported grant type is used during the OAuth2 authentication process in Elasticsearch. The grant type is a parameter that defines the method used to obtain the access tokens. To resolve this issue, ensure that you are using a supported grant type such as ‘password’, ‘client_credentials’, ‘refresh_token’, or ‘authorization_code’. Also, check your Elasticsearch version as some grant types may not be supported in older versions.

This guide will help you check for common problems that cause the log ” the grant type [{}] is not supported ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: plugin.

Log Context

Log “the grant type [{}] is not supported” class name is We extracted the following from Elasticsearch source code for those seeking an in-depth context :

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