Automattic / wp-calypso

The JavaScript and API powered WordPress.com
https://developer.wordpress.com
GNU General Public License v2.0
12.4k stars 1.98k forks source link

Jetpack Connection: redirected to connect start when WP is installed in a subdirectory #13509

Closed jeherve closed 6 years ago

jeherve commented 7 years ago

Steps to reproduce

  1. Starting on wp-admin with a site where WordPress is installed in a subdirectory.
  2. Click on the Connect button to start the Jetpack connection process.
  3. After connecting, you'll be redirected to the connection start.
  4. Your site is in fact properly connected behind the scenes.

https://videopress.com/v/JgOF5BpW

Related: #10980

jeherve commented 7 years ago

Also in 270-gh-jpop-issues

gaurav1984 commented 7 years ago

Possible Workaround from Rachel's suggestion on #3193730-t

Sign in to WordPress.com -> Visite https://wordpress.com/plans/ -> Choose Plan & Upgrade

sirreal commented 7 years ago

I believe this was fixed by #13879

@jeherve Can you confirm?

jeherve commented 7 years ago

@sirreal The problem is still happening for me, unfortunately.

jeherve commented 6 years ago

Also in 755855-zen

JulienMelissas commented 6 years ago

@sirreal, @jeherve - Just to mention - I was working on this related to a Jetpack connection issue because our sub-site is running Bedrock (thus putting WordPress in /wp/), and I was also running the "bleeding edge" version of Jetpack (5.5-alpha). It did not ask me to connect more than once.

georgestephanis commented 6 years ago

@jeherve Can you confirm whether or not this is still an issue?

JulienMelissas commented 6 years ago

I'm happy to test this, FYI

jeherve commented 6 years ago

Yep, still an issue. I just tested again to be sure.

georgestephanis commented 6 years ago

🆒 I'm flagging this for the next time I have a solid hour of time to step through the process, log all the requests, screencap the steps, and see where the deviation occurs.

georgestephanis commented 6 years ago

Just attempted to duplicate and couldn't -- screencapped the whole way -- I'm digging into why it's breaking for you right now but working for me.

https://cloudup.com/ca2OC-6YxCs

georgestephanis commented 6 years ago

I wonder if you may have a bad script cache or something from an old version of Calypso as it's working for me on gsteph.wpsandbox.me/wpsubdir -- the issue seems to be the redirect loop to the plan select page, which is really odd.

jeherve commented 6 years ago

Just attempted to duplicate and couldn't -- screencapped the whole way -- I'm digging into why it's breaking for you right now but working for me.

It looks like your whole site lives in a subdirectory, so home and siteurl have the same values. Try on a site where only WP lives in a subdirectory: https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

georgestephanis commented 6 years ago

Ah-ha! Okay that'd explain it.

georgestephanis commented 6 years ago

Okay, so following the network requests, I see a request failing at the end that kicks to that "enter a site" page --

Via a GET request to https://public-api.wordpress.com/rest/v1.1/me/settings?http_envelope=1

{  
  "code":401,
  "headers":[  
    {  
      "name":"Content-Type",
      "value":"application\/json"
    }
  ],
  "body":{  
    "error":"reauthorization_required",
    "message":"A fresh access token must be used to query information about the current user."
  }
}

I'm not sure the best way to track the inner processing in Calypso or how it's routing internally based on this api response. Will ping internally to see who can help with that.

adamengst commented 6 years ago

Any idea when this fix will be deployed? We have a site whose users can't connect with external apps because of the bug.

JulienMelissas commented 6 years ago

@adamengst - my sites have been working for a few weeks now actually! Do you have the latest of Jetpack?

adamengst commented 6 years ago

Yes, I'm using the latest Jetpack. But I misspoke slightly when I said "external apps." The connections I'm hoping to make are between the Google Docs for WordPress plugin and the Zoho Writer "Post to Blog" feature, both of which display an error page when trying to connect to my site. The URL looks like this:

https://staging.tidbits.com/wp-admin/?jetpack-code=24sSfkWyxqTWQm4qRT7WennXxX5swGH1&jetpack-user-id=754&jetpack-state=5f4ca27421

My developer said that it looks like they're trying to redirect to a URL that doesn't have the /wp in the WordPress URL, and thus failing, but he thought this fix would likely address the problem.

JulienMelissas commented 6 years ago

I don't want to speak for the Jetpack team, but that doesn't sound like a Jetpack issue. From my experience it sounds like an issue with the plugin not being compatible with WP in a different directory then the main, which is quite common. I see it a lot of with Bedrock sites if you're using that. Unfortunately I can't help too much more but if you are using Bedrock feel free to post on our forums. Good luck!

jeherve commented 6 years ago

@adamengst That fix was already deployed a few weeks ago, so your issue is most likely different.

If you'd like you can send us more details about the error you see and about your site through this form, we'll investigate with you! https://jetpack.com/contact-support/?rel=support

adamengst commented 6 years ago

Thanks guys! I've opened a ticket with Jetpack support.