# Problem using http\_poller to get access token from AppDynamics OAUTH API

**URL:** https://discuss.elastic.co/t/problem-using-http-poller-to-get-access-token-from-appdynamics-oauth-api/287006
**Category:** Logstash
**Created:** [October 18, 2021, 2:50pm UTC](https://discuss.elastic.co/t/problem-using-http-poller-to-get-access-token-from-appdynamics-oauth-api/287006 "2021-10-18T14:50:22Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![byoungman](https://avatars.discourse-cdn.com/v4/letter/b/838e76/32.png) [@byoungman](https://discuss.elastic.co/u/byoungman)
#### Post date: [October 20, 2021, 7:58pm UTC](https://discuss.elastic.co/t/problem-using-http-poller-to-get-access-token-from-appdynamics-oauth-api/287006/2 "2021-10-20T19:58:17Z")

</div>

Was able to get my http\_poller plugin returning an access token with the following configuration

```auto
	http_poller {
		urls => {
			AppDynamics => {
				method => post
				url => "https://vertex-test.saas.appdynamics.com/controller/api/oauth/access_token"
				body => "grant_type=client_credentials&client_id=xxxx@vertex-test&client_secret=xxxx"
				headers => {
					"Content-Type" => "application/vnd.appd.cntrl+protobuf;v=1"
				}
			}
		}
		request_timeout => 60
		schedule => { every => "15m"}
		codec => "json"
		metadata_target => "appd-token"
		type => "AppDynamics"
	}

```

But now I am getting an invalid access token error when the http filter plugin fires - this is the config for that

```auto
		http {
			body_format => "json"
			follow_redirects => false
			url => "https://xxxx.saas.appdynamics.com/controller/rest/applications/Vertex%20Cloud%20%28Stage%29/metric-data?metric-path=Application%20Infrastructure%20Performance%7COSP%20Servers%7CIndividual%20Nodes%7CSOSESB01%7CJVM%7CMemory%7CHeap%7CCurrent%20Usage%20%28MB%29&time-range-type=BEFORE_NOW&duration-in-mins=60"
			verb => "GET"
			headers => ["Authorization", "Bearer %{appd-token}"]
			target_body => "[@metadata][api_response]"
			target_headers => "[@metadata][api_headers]" 
		}

```

I am following the sample given by Yassine Lasri in this post [Http\_poller REST API authentication token](https://discuss.elastic.co/t/http-poller-rest-api-authentication-token/246870/5)

Getting closer...

Thanks,  
Bill

---

_[View the full topic](https://discuss.elastic.co/t/problem-using-http-poller-to-get-access-token-from-appdynamics-oauth-api/287006)._
