Posting Statuses on Pleroma with a Shell Script
With the help of alex@gleasonator.com, I was able to figure out finally how to get an OAuth access token so that I could post status updates whenever I publish a new blog post just like I used to do when I was running Mastodon. In reality it was actually very simple to do, but I was missing something that could be done because it was undocumented.
Everything that I tried is documented in the issue on the Pleroma GitLab in case you’re curious.
The right way to do what I wanted to do was, after creating an app with something like:
curl -s -S -i -X POST \
-F client_name="Blog Post Publishing Script" \
-F redirect_uris="urn:ietf:wg:oauth:2.0:oob" \
-F scopes="read write" \
https://pleroma.paritybit.ca/api/v1/apps
Do the following to get an access token:
curl -s -S -i -X POST \
-F client_id="LjLZPKhnDnwwrleqa85ODJXzhOubLF9bSi6TDyW602A" \
-F client_secret="<secret>" \
-F redirect_uri="urn:ietf:wg:oauth:2.0:oob" \
-F scope="read,write" \
-F grant_type="password" \
-F username="jbauer" \
-F password="<account_password>" \
https://pleroma.paritybit.ca/oauth/token
As opposed to everything else that I was trying to do with visiting the webpage and whatnot. It really is this simple. Now I just put this access token into my publish script and it will automatically post a status update whenever I publish a new blog post.
This is my eighty-ninth post for the #100DaysToOffload challenge. You can learn more about this challenge over at https://100daystooffload.com.