fediverse-devnet / feditest

A testing framework for distributed, heterogeneous systems communicating with complex protocols, such as the Fediverse
https://feditest.org/
MIT License
31 stars 6 forks source link

WordPress Node: login issues #285

Open steve-bate opened 1 month ago

steve-bate commented 1 month ago

When the code tries to log_in (get an OAuth access token), the response has a 400 HTTP status code. I've tried using the WordPress "user id" from the ActivityPub plugin author profile and I've tried the simple user name.

Looks like 'password' grant is not supported by the WordPress enable-mastodon-apps plugin. Response text (should have looked at that earlier!):

{
  "error": "unsupported_grant_type",
  "error_description": "Grant type \"password\" not supported"
}
steve-bate commented 1 month ago

Noticed this in the Mastodon.py docs (for authorization_code grants):

  For OAuth 2, obtain a code via having your user go to the URL returned by
  :ref:`auth_request_url() <auth_request_url()>` and pass it as the code parameter. In this case,
  make sure to also pass the same redirect_uri parameter as you used when
  generating the auth request URL.
steve-bate commented 1 month ago

FWIW, if I use the "Tester" tab from the enable-mastodon-apps plugin settings to create an access token interactively, I can use that token to create, boost and reply to posts in Wordpress.

steve-bate commented 1 month ago

I've created a proof-of-concept that automates the mastodon client creation with Wordpress by using the interactive authorization code OAuth flow and parsing web pages. :-/ It could probably be generalized a bit if we want to use this approach.

jernst commented 1 month ago

Is this basically the same situation as https://github.com/mastodon/mastodon/pull/30960 ?

steve-bate commented 4 weeks ago

The deprecation is probably why password flow is not supported in the PHP library that the WordPress plugin uses.