facing issue in integrating third party API in endpoint
I am tryign to integrate a third-party API calls in my endpoint using oauth.
steps :-
1. API call to get new access token.
I am getting below response >> {"expires_in":1209600,"refresh_token":"AVm+qqHWICxNvhDcNSvtFRIyMw==","access_token":"AZoOjM6fLc5PhGUwjgd7zCoyMQ=="}
2. I want to get 'access_token' value from above response and to pass this value in header for 2nd API call.
observation : If I hardcode it into a freemaeker variable then its working fine
<#assign a_token = "ASfJllLBFpNPucOl7hMQptwyMQ==" />
<#assign http_response_client_lists = http.client.request("https://api.createsend.com/api/v3.1/clients.json").header("Authorization", "Bearer "+a_token).get()
issue : when I store access_token into a freemarker variable and try to use that var in 2nd API, its not working.
<#assign a_token = json_response.access_token />
<#assign http_response_client_lists = http.client.request("https://api.createsend.com/api/v3.1/clients.json").header("Authorization", "Bearer "+a_token).get()
Am I missing anything here?
Please help me find the solution.
Thanks,
Vaishnavi