cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

unable to get token via api https://accountName.saas.appdynamics.com/controller/api/oauth/access_token

Tran.Vinh
Creator

I follow up on this doc to generate tokens via API but I didn't receive any response from the server.
https://docs.appdynamics.com/appd/4.5.x/en/extend-appdynamics/appdynamics-apis/api-clients#APIClient...
the curl like below:

curl -X POST -H "Content-Type: application/vnd.appd.cntrl+protobuf;v=1" "https://(accountName).saas.appdynamics.com/controller/api/oauth/access_token" -d 'grant_type=client_credentials&client_id=(username)@(accountName)&client_secret=(clientsecret)'
Please help me!



24 REPLIES 24

Hi @Joe.Catera 
I attached the image of the account name and client_name in some pictures below. Please help me check on the issue 401
Thanks
TranVinh_0-1679016849921.png

TranVinh_1-1679016907125.png

 

@Tran.Vinh, I spoke to our engineer again, and his last suggestion was to make sure your client secret was correct as well, even if that means generating a new one. If that doesn't work, please go to https://help.appdynamics.com/hc/en-us/requests and file a ticket, so our customer support team will look into it. I'd also make sure that the client name and account name don't have any trailing spaces. I hope regenerating a client secret helps, but if not, I'm sorry I couldn't help you.

@Joe.Catera 
It worked well after I got support from the customer support team.
Thank you so much.

Hi Tran.vinh, if you would like another example of how to get a token using an API secret, i'm doing the following on my rapport application: (https://github.com/open768/appdinc/blob/main/auth.php its in php, but hopefully you get the gist)

the querystring i use is

 

$oHttp->request_payload =
			"grant_type=client_credentials&" .
			"client_id=$app@$account&" .
			"client_secret=$api_secret";

 

with extra headers:

 

$oHttp->extra_headers = ["Content-Type" => "application/vnd.appd.cntrl+protobuf;v=1"];

 

 then do a GET request to the API for your controller  "/api/oauth/access_token"

this returns the access token to use for the API.

HTH

kind regards
Sunil

I know this is an older post, but we are experiencing the same issue, and are using the same curl statement parameters.  What did the support team do to correct the issue for you?