cancel
Showing results for 
Search instead for 
Did you mean: 

How to oauth in the crons of website

Occasional Advisor

How to oauth in the crons of website

Hi,

 

To fetch the reporting of a campaign like their clicks and open. We are using crons. as crons are files which get executed after a particular time interval.

 

Now as per your system of oauth how can i get verified and give grant access to my cron files.

First query how we can pass through verification and grant access with using this process. these for cron?

-Second I don't want to authenticate each time i logged in into website of mine. How to bypass this oauth process?

6 REPLIES 6
CTCT Employee

Re: How to oauth in the crons of website

Hi,

 

If you're using OAuth, all you need to do is store the access token that is generated when you grant access to the application.  Once you've stored the access token, it never expires and you can use it to authenticate your cron script.

 

To use the access token, you will append it to every URI that you make a request to, as below.

 

http://api.constantcontact.com/ws/customers/username/contacts?access_token=efa123456

 

Of course, your actual access token will be longer.  I hope that helps!

 

Best Regards,

Shannon W.

API Support Specialist

Occasional Advisor

Re: How to oauth in the crons of website

And this how can i get access token???

This we can get in verification file, when they redirect back to our site???

 

Is there any variable in code which is used as token

 

 

CTCT Employee

Re: How to oauth in the crons of website

Yes, right after the user grants access to your application (after inputting their username and password), an authorization code is returned to you in the url.  Then the authorization code is exchanged for the access token in the last step, when the user redirect back to your site.  You should be able to get the access token right from the URL--the access token is appended to the end of the redirect URI that you provide.

 

Here is a schematic of how the OAuth 2 process works.

 

Let me know if you have other questions.

 

Best Regards,

Shannon W.

API Support Specialist

Occasional Advisor

Re: How to oauth in the crons of website

https://api.constantcontact.com/ws/customers/{username}/campaigns/1101924210272?access_token=ddddd24...

 

As u said, I tried this to acces as i catch the token they provided.

but it's gives invalid token.

in this url token value is altered.

is m missing something???

Occasional Advisor

Re: How to oauth in the crons of website

The steps I followed.

1. Just provided grant access to api and get the access token

2 close the complete browser and reopened it.

3. just executed the url which you asked me to access but it seems it's not working.

Hope this will help you to understand the issue.

 

Please let me know how we can process without authentication of login and grantaccess????

Highlighted
CTCT Employee

Re: How to oauth in the crons of website

Hi,

 

It seems like what you are doing should be working, and I have verified that my access token is working so it's probably not a system issue.  Could you email your code to webservices@constantcontact.com so that we can take a look?

 

Best Regards,

Shannon W.

API Support Specialist