Security

HTTP 401 -- Unauthorized - API connection error after some requests

isa_melo
Observer

I have an error in authentication in the API, I do some authentications successfully, but then it gives an error HTTP 401 -- Unauthorized.

The problem may be that the connection is not closed, but I don't know how I could do it and if this is really the cause of the error.

private void authentication() {

Service.setSslSecurityProtocol(SSLSecurityProtocol.TLSv1);
serviceSplunk = new Service(configMap.getSplunkHost(), configMap.getSplunkPort());
String credentials = configMap.getSplunkUserName() + ":" + configMap.getSplunkPassword();
String basicAuthHeader = Base64.encode(credentials.getBytes());
serviceSplunk.setToken("Basic " + basicAuthHeader);

}

Help me, please!

Labels (4)
0 Karma
Get Updates on the Splunk Community!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...