I am developing an app (backside) in csharp to send emails using your API.
I am following this example https://github.com/EventDay/Infusionsoft.net, and using the OAuth process. I can create contacts, opt in, and send emails using my application name and access token, but that token is generated manually from infusionsoft admin page.
So, what I want to know is how to generate that token from the code using a call to the API, I have this piece of code:
private static void getAccess()
{
var client = new RestClient("https://api.infusionsoft.com/token");
var request = new RestRequest(Method.POST);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddParameter("application/x-www-form-urlencoded", "grant_type=client_credentials&client_id=xxxx&client_secret=xxxxx&code=1&redirect_uri=www.empowr.com", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
}
But I have not been able to retrieve correctly the access token, and then use that token in the refresh token process to always be connected.
So, could you help me to retrieve and refresh my access to the API?
Note. This process must be transparent to the users, they do not need to interact with app since it is a backend tool.
Thanks in advance,
Miguel