All Apps and Add-ons

Splunk Add-On Builder: When base64 encodes the credentials, why does the REST API input insert a newline character in Basic Auth header?

sjodle
Path Finder

I'm building a REST API input using the Splunk Add-On Builder. I'm trying to set up basic authentication for the REST call. However, when base64 encoding the credentials, the input inserts a newline character ("\n") in the middle of the base64 string. This causes an "invalid header value" HTTPError in the script output.

Other than the newline character, the auth string generated matches the working one generated by Postman.

This may have to do with the relatively long username and password used (Account Sid and Access Token for the Twilio REST API), as quick tests with a short username and password on other APIs do not demonstrate the issue.

0 Karma

gwang_splunk
Splunk Employee
Splunk Employee

Are you using the simple REST based data input?
If yes, sounds like a bug.

0 Karma

sjodle
Path Finder

Yep. We've reported it as such (see ehaddad's answer below)

0 Karma

ehaddad_splunk
Splunk Employee
Splunk Employee

If you are using REST input (not advanced mode) - all you need to do is
1- drag"Global Account" under mod input params
2- check "basic authentication" under the testing step
3- Make sure you input the username/passwrod values under the add-on setup parameters.

Is that what you are doing?

0 Karma

sjodle
Path Finder

Yes. And that works, except that it inserts the extra \n into my authentication header.

0 Karma

ehaddad_splunk
Splunk Employee
Splunk Employee

Looks like a bug to me. can you please create a support case for us to track? I already used 2.1.0 against many basic auth REST API. I did not get a problem but could be that your API is more restrictive about the \n
We will try to reproduce at our our end.

0 Karma

sjodle
Path Finder

Thanks. We are in the process of creating the ticket.

0 Karma

sjodle
Path Finder

Ticket number 455389 submitted.

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...