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.
Are you using the simple REST based data input?
If yes, sounds like a bug.
Yep. We've reported it as such (see ehaddad's answer below)
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?
Yes. And that works, except that it inserts the extra \n into my authentication header.
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.
Thanks. We are in the process of creating the ticket.
Ticket number 455389 submitted.