Authentica​tion using OAuth 2.0 for .Net application

Participant

Authentica​tion using OAuth 2.0 for .Net application

Hi,

I have downloaded .Net sample code ContactExample in the app.config file i entered my APIKey and in RedirectURL entered www.somedomain.com

when i am running the application it is showing the CC login form - here i am entering constant contact userid/ password.

 

I am getting error -

the client ID : APIKey is not valid or has been disabled.

 

Explain me following also;

How to login to CC without user interaction directly using code. As i want to write a integration applicaiton that will executed directly without any user interation.

 

 

1 REPLY 1
Employee

Hi,

 

This might be a case where you're using the wrong version of API Key for the wrapper.  If you're using our newest .net sdk here, you should use a V2 (Mashery) API Key, which has no dashes.  Go to the API Key tab on developer.constantcontact.com for instructions on how to generate a Mashery key.

 

If you're using the older .net wrapper, you'll need to generate a V1 API Key to make it work.  I'd recommend using the newer sdk, since its shelf life will be longer.

 

Once the correct version of API Key is put into the wrapper, you should stop getting that error.

 

As for bypassing the login & granting access step, you'll just want to code your access token into your application (or better, into a secure database that your application accesses).  If you're using the newer wrapper, you can take out this line, which sends you to the authentication form:

 

_accessToken = OAuth.AuthenticateFromWinProgram(ref state);

 

And replace it with something that retrieves the access token from somewhere else (or hard codes it), like below:

 

_accessToken = "accessTokenValue";

 

 

Best Regards,

Shannon W.

API Support Specialist

 

 

Developer Portal

View API documentation, code samples, get your API key.

Visit Page