The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

Api Key Redirect URI for multiple subdomains?

Highlighted
Occasional Contributor

Api Key Redirect URI for multiple subdomains?

Hello,

 

I am integrating out application with CC.

At first I was under the impression our users would have to make their own API key, we would store their key and consumer secret, get the access_token and away we go.

 

Then I read a post which we could host the API key, and have our multiple different clients integrate to our app without entering any parameters (Just the OAuth log in that's prompted).

 

Now here's the problem, our system is divided into multiple subdomains (example.whatever.com, example2.whatever.com), yet hosted on the same server.  Is there a way for us to use the API key with multiple subdomains, considering the redirect URI?  (Wildcard parameters?)

 

Thanks,

 

Jordan Clark

4 REPLIES 4
Highlighted
Employee

Re: Api Key Redirect URI for multiple subdomains?

Hi Jordan,

 

The simplest solution I can think of would be to make as many API Keys for your account as subdomains ( e.g. 5 subdomains, 5 API Keys, each with an appropriate redirect URI).  One account can have an unlimited number of API Keys.  Your users still wouldn't have to generate their own API keys--you would do that in advance, they would go through the OAuth2 process, and you would store their access tokens.

 

Best Regards,

Shannon W.

API Support Specialist

Highlighted
Occasional Contributor

Re: Api Key Redirect URI for multiple subdomains?

Thanks Shannon for your quick reply!

 

I don't think manually creating an API key for each customer is realistic in our scenario, so we will have a walkthrough for  customers to create their own API key - which we will then store and use.

 

Thanks again,

 

Jordan Clark

Highlighted
Moderator

Re: Api Key Redirect URI for multiple subdomains?

An alternate solution could be to use a single domain for the redirect, use a query parameter on that redirect URL to specify which subdomain the request initiated from and then on the single shared redirect URI, do a 302 redirect to the appropriate subdomain with the appropriate information.  This would allow you to use a single API key, single redirect URI but still maintain the sub-domain architecture your set up for with your customers.

Dave Berard
Senior Product Manager, Constant Contact
Highlighted
Occasional Contributor

Re: Api Key Redirect URI for multiple subdomains?

That's an amazing idea Dave, thanks!  I'm going to try it over the weekend.

 

I'll let you know how it turns out!

 

Jordan Clark

Developer Portal

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

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured