Aug 18

How to resolve Jetpack error: Invalid request, please go back and try again.Error Code: invalid_request. Error Message: Mismatch in redirect_uri.

How to resolve Jetpack error: Invalid request, please go back and try again.Error Code: invalid_request. Error Message: Mismatch in redirect_uri.

I have a multisite installation and thus far on all my sites I have been able to relink all of them to Jetpack. However, in one of my sites when I click the Link account with WordPress.com button it throws the following error message:

Invalid request, please go back and try again.
Error Code: invalid_request
Error Message: Mismatch in redirect_uri.

I´ve been looking around for a simple solution and thus far I have not been successful. I tried looking at the URI that is on the browser with no luck either:

https://jetpack.wordpress.com/jetpack.authorize/1/?response_type=code&client_id=50991698&redirect_uri=http%3A%2F%2Fmysite.bauzas.com%2Fwp-admin%2Fadmin.php%3Fpage%3Djetpack%26action%3Dauthorize%26_wpnonce%3D83c41c040f&state=3&scope=administrator%3A879fbaec7b4fcd5bebffbac1130aec17&user_email=myemail%40bauzas.com&user_login=adminuser&is_active=1

So, I am not great with special characters but the redirect_uri seems about right. My guess at this point is that it has to do something with my site having a different URL when I first activated it and now it has a different one…And what do you know changing that worked! Well, it did work on getting the Jetpack page to display it just didn´t do anything for my installation. So at this point I am guessing modifying the database on my site to reset the connection is in place. Obviously I want to stay away from making this a bigger mess so I am going to take the longest safest route which is to deactivate the plugin and activate it again like so:

1. Go to PLUGINS and De-Activate Jetpack. If you are in Multisite you are going to have to go to the network administration and this is going to impact ALL of your site. Be ready to reactivate them ALL. Also, your settings that you might have already configured will be gone with the wind as well. I would recommend a backup in case you miss something.

2. Then DELETE Jetpack. You will be given the following message:

Delete Plugin

Caution: This plugin may be active on other sites in the network.

You are about to remove the following plugin:

  • Jetpack by WordPress.com by Automattic (will also delete its data)

Are you sure you wish to delete these files and data?

Click to view entire list of files which will be deleted

3. Download a fresh install of Jetpack.

3. Then go to ADD PLUGINS and navigate to the ZIP file that you’ve just downloaded.

4. Once installed, activate it and you should be able to complete the process. Remember you need to do this on each site on a multisite installation:

Jetpack is activated! Each site on your network must be connected individually by an admin on that site.

And unfortunately to me this seems to have worked for some users reporting the issue but not for myself. I am going to guess it did not delete the file or something got cached as none of the settings were lost. So moving on to plan B: restoring the original site URL and trying my luck. go to Sites > All Sites > Edit the site with the issue > In the info the first line is the Domain were you can change the URL of said site.

Plan B did the trick for me. Obviously I was reluctant to do this as under the hood this issue persists. Now that I am going to change my site name again in the future I might have issues with Jetpack again because of this. That´s when I saw the two status indicators on the top, one which allows you to unlink your account from Jetpack:

Connected to WordPress.com
Disconnect from WordPress.com

So Eureka! What you need to do at this point is to:

  1. Revert the site name back to the original URL
  2. Proceed to reconnect with WordPress as indicated on Plan B
  3. Once you are reconnected you should hover over the “Connected to WordPress.com” status on the top right so that it reads “Disconnect from WordPress.com”. Click on it
  4. Once you are disconnected, you should change the URL of your site back to the one you want it to use.
  5. Go back to Jetpack and connect your site.
  6. You´re done!

Some people when connecting for the first time might encounter issues. Below are a few you might keep in mind with their respective solutions. Good luck!

Enhanced by Zemanta

1 comment

  1. Jetpack has moved the disconnect to the bottom right of the main settings page, but other then that thanks for a great solution.

Leave a Reply

%d bloggers like this: