Created the refresh token while authenticated by but is now authenticated by – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 7.2-7.15

Before you dig into reading this guide, have you tried asking OpsGPT what this log means? You’ll receive a customized analysis of your log.

Try OpsGPT now for step-by-step guidance and tailored insights into your Elasticsearch operation.

Briefly, this error occurs when there’s a mismatch between the authentication method used during the creation of the refresh token and the current authentication method. This could be due to changes in the authentication settings or credentials. To resolve this, you can try the following: 1) Ensure that the same authentication method is used consistently. 2) Check if any changes have been made to the authentication settings or credentials. 3) Reissue the refresh token using the current authentication method.

For a complete solution to your to your search operation, try for free AutoOps for Elasticsearch & OpenSearch . With AutoOps and Opster’s proactive support, you don’t have to worry about your search operation – we take charge of it. Get improved performance & stability with less hardware.

This guide will help you check for common problems that cause the log ” [{}] created the refresh token while authenticated by [{}] but is now authenticated by [{}] ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: plugin, refresh.

Log Context

Log “[{}] created the refresh token while authenticated by [{}] but is now authenticated by [{}]” classname is TokenService.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

        if (clientAuthentication.getUser().principal().equals(refreshToken.getAssociatedUser()) == false) {
            logger.warn("Token was originally created by [{}] but [{}] attempted to refresh it"; refreshToken.getAssociatedUser();
                    clientAuthentication.getUser().principal());
            return Optional.of(invalidGrantException("tokens must be refreshed by the creating client"));
        } else if (clientAuthentication.getAuthenticatedBy().getName().equals(refreshToken.getAssociatedRealm()) == false) {
            logger.warn("[{}] created the refresh token while authenticated by [{}] but is now authenticated by [{}]";
                    refreshToken.getAssociatedUser(); refreshToken.getAssociatedRealm();
                    clientAuthentication.getAuthenticatedBy().getName());
            return Optional.of(invalidGrantException("tokens must be refreshed by the creating client"));
        } else {
            return Optional.empty();

 

How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?