Get access token without navigating in a browser

BethA83512
Constant Contact Partner
0 Votes

I am trying to get an access token via a php Curl request. From all the responses I'm seeing here as well as the API v3 documentation itself, you go to a url in your browser like:

 

https://api.cc.email/v3/idfed?client_id=my_api_key&redirect_uri=https://localhost&response_type=toke...

 

This in turn redirects you to a constant contact login page. You log in and it redirects you to a page that has the access token in the url.

 

How do I retrieve the access token without having to manually go to the url and login via a browser? There has to be a way to get this.  Other APIs do not make you use a browser. Given that you're using OAuth2, is it possible to use the public/private key combined with username/password (grant_type of password)?

3 REPLIES 3
Courtney_E
Employee
0 Votes

Hello BethA83512,

 

Thank you for reaching out to Constant Contact API Developer Support. My team is here to assist outside software developers with questions about building into Constant Contact's API.

 

There is currently no way to bypass the initial Authorization Request screen, which can only be accessed/authorized via a browser window, but you should only need to authorize an account once. 

 

After you complete the OAuth2 server flow for V3, Constant Contact returns an access token and refresh token. You can use access tokens to make requests using the V3 API, and you can use the refresh tokens to obtain new access tokens without any user input. This ensures that you only need to authenticate the account you’ll be connecting to once. After the initial authentication, you’ll just use the refresh token and access token to complete your future requests.

 

V3 API OAuth2.0 Server Flow

https://v3.developer.constantcontact.com/api_guide/server_flow.html

 

Tokens Overview

https://developer.constantcontact.com/api_guide/auth_overview.html#tokens

 

Please have a look and let us know if you have any other questions!


Regards,

Courtney E.
Tier II API Support Engineer

Did I answer your question?
If so, please mark my post as an "Accepted Solution" by clicking the Accept as Solution button in the bottom right hand corner of this post.
user928830
Rookie
0 Votes

Constant contact seems to make a huge job of connecting their API to website-- I have just signed up to Constant contact and already thinking of ditching it.  Other autoresponders just provide and API which you easily add to your website- and all is good to go

John__B
Employee
0 Votes

Hello user928830,

 

Thank you for reaching out to Constant Contact API Developer Support. My team is here to assist outside software developers with questions about building into Constant Contact's API.

 

Thanks for your reply! Your feedback and experience with this request is essential to improving our product, so thank you for reaching out to us regarding this matter.

 

We're currently making updates to our authentication system. This work would need to be completed prior to implementing additional authentication flows, however we are looking into them as future options. Some of the options currently under consideration include: Client Credentials flow, the Device Authorization flow, static refresh tokens, etc.

 

If you have a specific use case or auth type that you feel would better meet your needs, we’d love to hear from you. If possible, please include what specific solution(s) you’re looking for, whether your app would only access your own Constant Contact’s account data or if it would also be used by other accounts, etc. You can reply here, or contact us directly via email at webservices@constantcontact.com.

 

Regards,


John B.
API Support Specialist
Did I answer your question? If so, please mark my post as an "Accepted Solution" by clicking the Accept as Solution button in the bottom right hand corner of this post.
Resources
Developer Portal

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

Visit Page

Announcements

API Updates

Join our list to be notified of new features and updates to our V3 API.

Sign Up