C# integration raises an exception


I have a C# WinForms application in VS2015 CE that I am trying to use the .NET library with. When it gets to the ExchangeToken bit, it raises an exception of type createsend_dotnet.CreateSendException with the following additional information:

The CreateSend OAuth receiver responded with the following error - invalid_request: Required parameters were not supplied

Now, the thing is this: I took the sample out of the MVC example available on GitHub, so chances are the integration does not support desktop apps.

This is my current code:

// Make the authorize call. This could be encapsulated in a "Connect" method.
            AuthorizeURL = General.AuthorizeUrl(ClientID, ClientRedirect, PermissionsText);
            AuthToken = GetParamValueFromUrl(AuthorizeURL,"code");
            var tokenDetails = General.ExchangeToken(ClientID, ClientSecret, ClientRedirect, AuthToken);
            AccessToken = tokenDetails.access_token;
            RefreshToken = tokenDetails.refresh_token;
            // Now that we have an authorization token, we must also get the full auth/refresh
            // tokens. This, too, can be "hidden" inside the connect method so that we
            // avoid having too much code on hand.
            authDetails = new OAuthAuthenticationDetails(AccessToken, RefreshToken);
            // Then we initialise the general API.
            GeneralAPI = new General(authDetails);

Can you see anything blatantly wrong?



Join 150,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free