Showing results for 
Search instead for 
Did you mean: 
Constant Contact wants to help you succeed! We’re celebrating our professional service programs on the Constant Contact Community this month and you have a chance to try one of the services for free! Learn more.

Invalid redirect


Re: Invalid redirect

Hi Dave, 

                Thanks for the response. Looks like, I was able to resolve my issue with adding website to the application. It would really help WEB SITE if you make this a required field. Atleast for future users.


invalid redirect was really misdirecting and I wasted almost a day, looking at the gem and some error from my end.


It would also help atleast if the error message can give little more detail or some kind of documentation that could say the possible causes of the same error, but different reasons. 

New Member

Re: Invalid redirect

    <title>Constant Contact API v2 OAuth2 Example</title>
    <link href="//" rel="stylesheet">
    <link href="styles.css" rel="stylesheet">

README: Get an access token
This example flow illustrates how to get an access token for a Constant Contact account owner using the OAuth2 server flow.
You must have a valid Constant Contact API Key, consumer sercret, and associated redirect_uri. All of these can be obtained from

// require the autloader
require_once '../src/Ctct/autoload.php';

use Ctct\Auth\CtctOAuth2;
use Ctct\Exceptions\OAuth2Exception;

// Enter your Constant Contact APIKEY, CONSUMER_SECRET, and REDIRECT_URI
define("APIKEY", "[REDACTED]");

// instantiate the CtctOAuth2 class


<div class="well">
    <h3>OAuth 2 Authorization Example</h3>

    // print any error from Constant Contact that occurs during the authorization process
    if (isset($_GET['error'])) {
        echo '<span class="label label-important">OAuth2 Error!</span>';
        echo '<div class="container alert-error"><pre class="failure-pre">';
        echo 'Error: ' . $_GET['error'];
        echo '<br />Description: ' . $_GET['error_description'];
        echo '</pre></div>';

    // If the 'code' query parameter is present in the uri, the code can exchanged for an access token
    if (isset($_GET['code'])) {
        try {
            $accessToken = $oauth->getAccessToken($_GET['code']);
        } catch (OAuth2Exception $ex) {
            echo '<span class="label label-important">OAuth2 Error!</span>';
            echo '<div class="container alert-error"><pre class="failure-pre">';
            echo 'Error: ' . $ex->getMessage();
            echo '</pre></div>';

        echo '<span class="label label-success">Access Token Retrieved!</span>';
        echo '<div class="container alert-success"><pre class="success-pre">';
        echo '</pre></div>';

    } else {
        <!-- If the 'code' query parameter is not present, display the link the user needs to visit to initiate the oauth flow -->
        <button class="btn btn-primary" type="button"
                onclick="window.location.href='<?php echo $oauth->getAuthorizationUrl(); ?>';">Get Access Token
    <?php } ?>



Please solve this issue

Honored Contributor

Re: Invalid redirect



You can correct this issue by editing your API key in Mashery so that yhe Redirect URI matches the URI that is used in your code. To edit your key you will need to navigate to and log in to your Constant Contact developer account. Once you have updated the key, it may take up to 5 minutes for those changes to be fully propagated to our servers.


If you continue to have any issues after updating your Redirect URI, please let me know!



Elijah G.
API Support Engineer
Occasional Visitor

Re: Invalid redirect


Is anyone still facing the same "Redirect URI mismatch" issue?


I'm trying to use the OmniAuth gem for Rails and my application seems to be going to Constant Contact correctly till "Allow Access?"( page  but then it fails  with error message "Redirect URI mismatch" error.

redirect_uri_mismatch: Redirect URI mismatch. {

"error": "redirect_uri_mismatch", "error_description": "Redirect URI mismatch."


My callback URI for application is set as http://localhost:3000/auth/constantcontact/callback


Re: Invalid redirect



Looking at that github the redirect URI you are using is listed as the development redirect according to the file. It is also linking to our older v1 API information. Are you using a v1 API or a v2 API key? Do not post your API key. Did you create your API key using this website?


If you did then log in and click on My Account in the upper right. Click on Applications, then click on Edit. This will show you what redirect URI you have set up for your API key. It needs to match the redirect that is in your code. You can change either location. If you change the information in the API key location it can take up to 10 minutes to update.


If you need to post information that should be kept private I suggest to email us at

Jimmy D.
Tier II API Support Engineer
Occasional Visitor

Re: Invalid redirect

Invalid redirect.

Please close the window to return to your application.