mastodon_wordpress_autopost icon indicating copy to clipboard operation
mastodon_wordpress_autopost copied to clipboard

Authorization fails silently

Open samueltardieu opened this issue 5 years ago • 14 comments

Hi.

I just installed Mastodon Autopost on a Wordpress 4.9.8 server (https://rose.telecom-paristech.fr/2019) that we are configuring. This WP server, despite being accessible from the internet, must use a proxy to access the internet, and this proxy is configured properly (WP_PROXY_HOST/WP_PROXY_PORT) and works fine to retrieve for example Wordpress plugins or upgrade Wordpress automatically.

When I choose my instance https://mamot.fr (the account is https://mamot.fr/@rose) I get redirected to the authorization page on mamot.fr as expected, I press "Authorize" and get redirected to the Mastodon Autopost page on my Wordpress server.

However:

  • No application is authorized on mamot.fr when I check.
  • The Mastodon Autopost settings requests that I add a Mastodon account.

I also used with an account on mastodon.social to rule out any mamot.fr specificity, with the same results.

Any idea of what might have happened and how to fix it?

samueltardieu avatar Oct 31 '18 20:10 samueltardieu

It could have something todo with the proxy. Sorry I never had that case.

Could you provide me with the manual how you did setup the proxy? (So maybe I can reproduce the bug on my testsystem)

simonfrey avatar Dec 11 '18 15:12 simonfrey

At the end of wp-config.php, I have:

define('WP_PROXY_HOST', 'host.name.of.my.proxy');
define('WP_PROXY_PORT', '3128');
define('WP_PROXY_BYPASS_HOSTS','localhost');

samueltardieu avatar Dec 11 '18 15:12 samueltardieu

So with what url do you access your wordpress? Via the proxy url or the wordpress url?

simonfrey avatar Dec 11 '18 16:12 simonfrey

Via wordpress URL. My wordpress is reachable from outside (https://rose.telecom-paristech.fr/2019), but it cannot itself access outside resources without using the proxy.

samueltardieu avatar Dec 11 '18 16:12 samueltardieu

All the research I did brought me to the conclusion, that the standard wp_remote_get/post() I use should work with proxy.

Are you sure that your provider allows outgoing connections trough the proxy?

simonfrey avatar Dec 11 '18 17:12 simonfrey

Yes. Not only did the plugin (as well as all updates to wordpress and plugins) get installed through the proxy, but a Twitter gateway plugin works just fine as well through the proxy. It is also my understanding that wp_remote_{get,post} uses the proxy. Unfortunately, I couldn't find a setting in the plugin to enable debugging and trace what currently happens.

samueltardieu avatar Dec 11 '18 19:12 samueltardieu

I am having a related issue, I click Authorize, am sent to Mastodon.social where I confirm, and then I'm redirected to my homepage and nothing has happened. I have no proxy setup though.

RosemaryOrchard avatar Apr 03 '19 10:04 RosemaryOrchard

@RosemaryOrchard On what mastodon version is your server on? With the last update I introduced the narrowed down scopes, that are only available from v2.4.3 on.

simonfrey avatar Apr 03 '19 11:04 simonfrey

According to https://mastodon.social/about it's running v2.8.0rc1

RosemaryOrchard avatar Apr 03 '19 11:04 RosemaryOrchard

I'm having the same problem as @RosemaryOrchard with https://mastodon.sdf.org, which runs v2.7.4.

asgartech avatar Apr 10 '19 01:04 asgartech

Same issue as @RosemaryOrchard on mastodon.social. I am unsure of where I can check mastodon.social's Mastodon version.

arunsathiya avatar May 02 '19 04:05 arunsathiya

same issue on mstdn.su - v2.6.1

Fatal error: Uncaught Error: Call to a member function get() on null in /home/public_html/wp-includes/query.php:28 
WP_Hook->apply_filters('HTTP/1.1 302 Fo...', Array) #3 /home/public_html/wp-includes/functions.php(1240): apply_filters('status_header', 'HTTP/1.1 302 Fo...', 302, 'Found', 'HTTP/1.1') #4 /home/public_html/wp-includes/pluggable.php(1235): status_header(302) #5 /home/public_html/wp-content/plugins/autopost-to-mastodon/mastodon_autopost.php(83): wp_redirect('https://planetr...') #6 /home/public_html/wp-includes/class-wp-hook.php(286): autopostToMastodon->init('') #7 /home/public_html/wp-includes/class-wp-hook.p in /home/public_html/wp-includes/query.php on line 28

sabinich avatar May 07 '19 04:05 sabinich

Would you folks please try again with version 3.2.8 ? I hope it is fixed now. On my wp it works with chaos.social

Thanks

simonfrey avatar May 13 '19 15:05 simonfrey

I am afraid it's not, for me. I am on 3.2.8 now, but I see this after authenticating with mastodon.social:

Warning: Cannot modify header information - headers already sent by (output started at /srv/users/usera1de559a/apps/usera1de559a/public/wp-content/plugins/autopost-to-mastodon/mastodon_autopost.php:49) in /srv/users/usera1de559a/apps/usera1de559a/public/wp-includes/pluggable.php on line 1251

Warning: Cannot modify header information - headers already sent by (output started at /srv/users/usera1de559a/apps/usera1de559a/public/wp-content/plugins/autopost-to-mastodon/mastodon_autopost.php:49) in /srv/users/usera1de559a/apps/usera1de559a/public/wp-includes/pluggable.php on line 1254
Authentification, please wait...

I waited a bit to see if the page redirects me to the intended view, but no, it does not.

arunsathiya avatar May 13 '19 15:05 arunsathiya