indieweb / wordpress-micropub

A Micropub Endpoint plugin for WordPress
https://wordpress.org/plugins/micropub
52 stars 13 forks source link

Bug: Posting from Omnibear with IndieAuth fails. #133

Open miklb opened 6 years ago

miklb commented 6 years ago

Using master of WP Indieauth & micropub plugins, attempting to post from Omnibear results in 2 errors

PHP Warning:  in_array() expects parameter 2 to be array, null given in /plugins/micropub/micropub.php on line 265

PHP Warning:  in_array() expects parameter 2 to be array, null given in /plugins/micropub/micropub.php on line 268

I recall changes to these two lines in another issue, but do not recall where that issue was (maybe Indieauth plugin?)

Omnibear reports failure to authenticate with micropub endpoint.

dshanske commented 6 years ago

This is interestingly telling. This suggests that somehow, the scope information isn't making it from IndieAuth into Micropub. But why would it on some sites and not on others.

keithjgrant commented 6 years ago

It's also strange that it would occur for Omnibear, but not some other MP clients like Quill…?

keithjgrant commented 6 years ago

Is Omnibear requesting scopes differently when authenticating to the auth endpoint?

dshanske commented 6 years ago

At the very least, we should initialize the variables before use.

@keithjgrant What scopes does Omnibear request?

keithjgrant commented 6 years ago

Hm... Skimming the code (albeit on phone, so I could be missing something) it doesn't look like Omnibear specifies. That could be the issue, depending whether different auth services fallback to all scopes by default, or null set...?

dshanske commented 6 years ago

We don't fallback.

dshanske commented 6 years ago

https://indieauth.spec.indieweb.org/#authorization-request - I'd better go check my code on the IndieAuth plugin.

dshanske commented 6 years ago

I was misremembering. We do. https://github.com/indieweb/wordpress-indieauth/blob/948165cb30f211eaf416b69996ee0e43d8ada666/includes/class-indieauth-authorization-endpoint.php#L86

dshanske commented 6 years ago

This is not related to the Semantic Linkbacks problem.

miklb commented 6 years ago
POST /?micropub=endpoint HTTP/1.1" 403 76 "-"
POST /?micropub=endpoint HTTP/1.1" 201 12 "-" "-"

Top is Omnibear, bottom is Quill in my access logs. Not sure jf anything useful there, but documenting nonetheless.

dougbeal commented 6 years ago

I’m running latest plugin releases. Attempted reacji w/Omnibear in firefox

webserver-wordpress_1 | 2018/07/17 06:06:48 [notice] 5#5: *6382 "^/.well-known/(host-meta|webfinger).*" does not match "/index.php", client: 71.212.132.198, server: dougbeal.com, request: "POST /?micropub=endpoint HTTP/1.1", host: "dougbeal.com" [17-Jul-2018 06:06:48 UTC] Micropub Data: {"micropub":"endpoint"} {"type":["h-entry"],"properties":{"content":["\ud83d\udc94"],"in-reply-to":["https:\/\/www.instagram.com\/p\/BlUNv51FerF\/"]}} [17-Jul-2018 06:06:49 UTC] PHP Warning: in_array() expects parameter 2 to be array, null given in /var/www/html/wp-content/plugins/micropub/micropub.php on line 265 [17-Jul-2018 06:06:49 UTC] PHP Warning: in_array() expects parameter 2 to be array, null given in /var/www/html/wp-content/plugins/micropub/micropub.php on line 268 wordpress_1 | 172.18.0.4 - 17/Jul/2018:06:06:48 +0000 "POST /index.php" 403 webserver-wordpress_1 | 71.212.132.198 - - [17/Jul/2018:06:06:49 +0000] "POST /?micropub=endpoint HTTP/1.1" 403 98 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:61.0) Gecko/20100101 Firefox/61.0" "-"

(Originally published at: https://crw.moe/b/Xg)

dshanske commented 6 years ago

This has been determined to be a problem with cookie authentication preventing the token authentication from being used. Solution at this time is to log out of the site on the browser you are using to post.