# HTTP Poller authentication: encode token

**URL:** https://discuss.elastic.co/t/http-poller-authentication-encode-token/143532
**Category:** Logstash
**Created:** [August 8, 2018, 2:07pm UTC](https://discuss.elastic.co/t/http-poller-authentication-encode-token/143532 "2018-08-08T14:07:21Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![AurelienG](https://avatars.discourse-cdn.com/v4/letter/a/76d3ee/32.png) [@AurelienG](https://discuss.elastic.co/u/AurelienG)
#### Post date: [August 8, 2018, 2:07pm UTC](https://discuss.elastic.co/t/http-poller-authentication-encode-token/143532/1 "2018-08-08T14:07:21Z")

</div>

Hello,  
I am trying to use the HTTP Poller input plugin to get data from an API. Although, I need to authenticate with a basic authentication, with username and token. This would be a problem if the token didn't have to be encoded... Is there a way to use a function such as encode64(token) in this input?  
If this is not possible I think I can do it with a curl command in exec input.  
Here is what my input config looks like:

```auto
http_poller {
		urls => {
			jenkins_metrics => {
				url => "https://url.to.api/"
				headers => {
					Accept => "application/json"
					Authorization => "Basic username:token"
			}
		codec => json
		}
	}
	schedule => { cron => "* * * * *" }
}

```

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [August 8, 2018, 2:26pm UTC](https://discuss.elastic.co/t/http-poller-authentication-encode-token/143532/2 "2018-08-08T14:26:48Z")

</div>

Your overcomplicating things; just use the plugin's `user` and `password` options.

---

<div class="post-metadata">

### Author: ![AurelienG](https://avatars.discourse-cdn.com/v4/letter/a/76d3ee/32.png) [@AurelienG](https://discuss.elastic.co/u/AurelienG)
#### Post date: [August 8, 2018, 2:35pm UTC](https://discuss.elastic.co/t/http-poller-authentication-encode-token/143532/3 "2018-08-08T14:35:25Z")

</div>

I guess you're right.  
Thanks for the quick answer!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [September 5, 2018, 2:35pm UTC](https://discuss.elastic.co/t/http-poller-authentication-encode-token/143532/4 "2018-09-05T14:35:25Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
