eupolicy.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
This Mastodon server is a friendly and respectful discussion space for people working in areas related to EU policy. When you request to create an account, please tell us something about you.

Server stats:

225
active users

#mastodonapi

0 posts0 participants0 posts today
Jeff Sikes<p>Featured profiles snuck their way onto mastodon.social in a nightly build. Check out the last section of my Featured tab - only visible on Mastodon web (for now)!</p><p><a href="https://mastodon.social/@box464/featured" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">mastodon.social/@box464/featur</span><span class="invisible">ed</span></a></p><p><a href="https://mastodon.social/tags/Mastodon" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Mastodon</span></a> <a href="https://mastodon.social/tags/mastodonapi" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>mastodonapi</span></a></p>
Gator3000<p>Some new <a href="https://mastodon.social/tags/logo" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>logo</span></a> for masthon!</p><p>Clue to understand : what's the french word for "Tuna"... 🐟 </p><p><a href="https://mastodon.social/tags/Masthon" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Masthon</span></a> <a href="https://mastodon.social/tags/Mastodon" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Mastodon</span></a> <a href="https://mastodon.social/tags/mastodonapi" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>mastodonapi</span></a> <a href="https://mastodon.social/tags/API" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>API</span></a> <a href="https://mastodon.social/tags/python" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>python</span></a></p>
Andy Piper<p>An opportunity for client app developers, who wants to give this a try? <a href="https://macaw.social/tags/MastodonAPI" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>MastodonAPI</span></a><br><a href="https://fosstodon.org/@sethmlarson/114432911055034192" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">fosstodon.org/@sethmlarson/114</span><span class="invisible">432911055034192</span></a></p>
Gator3000<p>🎉 <a href="https://mastodon.social/tags/Masthon" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Masthon</span></a> 0.1.1 alpha is now up ! :catjam: </p><p>Masthon is a package that links your programs to the mastodon <a href="https://mastodon.social/tags/API" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>API</span></a> </p><p>The version 0.1.1 alpha is published on <a href="https://mastodon.social/tags/gitlab" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>gitlab</span></a> : Come on and review, see my <a href="https://mastodon.social/tags/code" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>code</span></a> at <a href="https://gitlab.com/Gator3000/masthon/-/releases" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">gitlab.com/Gator3000/masthon/-</span><span class="invisible">/releases</span></a>.</p><p>You can install the package with <a href="https://mastodon.social/tags/pip" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>pip</span></a> :<br>```<br>pip install git+<a href="https://gitlab.com/Gator3000/masthon.git" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">gitlab.com/Gator3000/masthon.g</span><span class="invisible">it</span></a><br>```<br>The <a href="https://mastodon.social/tags/documentation" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>documentation</span></a> will be available tomorrow when the beta will be published.</p><p>If you want information or to <a href="https://mastodon.social/tags/contribute" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>contribute</span></a> tell me on this account.</p><p><a href="https://mastodon.social/tags/python" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>python</span></a> <a href="https://mastodon.social/tags/mastodonapi" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>mastodonapi</span></a> <a href="https://mastodon.social/tags/opensource" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>opensource</span></a></p>
Gator3000<p>Hello from the <a href="https://mastodon.social/tags/API" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>API</span></a> at time : `Mon Apr 28 17:54:45 2025`.<br>The project used is **<a href="https://mastodon.social/tags/Masthon" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Masthon</span></a>** a simple <a href="https://mastodon.social/tags/python" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>python</span></a> package whitch links to <a href="https://mastodon.social/tags/Mastodon" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Mastodon</span></a> coded by an <a href="https://mastodon.social/tags/french" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>french</span></a> student !<br>Let's check my <a href="https://mastodon.social/tags/code" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>code</span></a> on <a href="https://mastodon.social/tags/gitlab" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>gitlab</span></a> -&gt; <a href="https://gitlab.com/Gator3000/masthon.git" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">gitlab.com/Gator3000/masthon.g</span><span class="invisible">it</span></a>. It's <a href="https://mastodon.social/tags/opensource" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>opensource</span></a> !</p><p>Talk to me about my project at `<span class="h-card" translate="no"><a href="https://mastodon.social/@gator3000" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>gator3000</span></a></span>` or on discord `_gator3000`</p><p>This is an automatic message posted every times I test my code. Tell me if it spam :)</p><p><a href="https://mastodon.social/tags/mastodonAPI" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>mastodonAPI</span></a> <a href="https://mastodon.social/tags/masto" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>masto</span></a> <a href="https://mastodon.social/tags/fran%C3%A7ais" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>français</span></a> <a href="https://mastodon.social/tags/developpement" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>developpement</span></a> <a href="https://mastodon.social/tags/dev" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>dev</span></a></p>
Jeff Sikes<p>I don't know much about this mastodon api client yet, but it sure looks cute. Lots of fun, exaggerated animations. </p><p><a href="https://antijingoist.itch.io/hai" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="">antijingoist.itch.io/hai</span><span class="invisible"></span></a></p><p><a href="https://mastodon.social/tags/MastodonAPI" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>MastodonAPI</span></a> <a href="https://mastodon.social/tags/MastodonApp" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>MastodonApp</span></a> <a href="https://mastodon.social/tags/fediapp" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>fediapp</span></a></p>
Jeff Sikes<p>Not many app developers use the Mastodon Sign Up API, but note if you do, there is a breaking change coming you need to be aware of - optional age verification.</p><p>Now I’m kinda curious which apps DO use this!</p><p><a href="https://github.com/mastodon/mastodon/discussions/34495" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">github.com/mastodon/mastodon/d</span><span class="invisible">iscussions/34495</span></a></p><p><a href="https://mastodon.social/tags/MastodonAPI" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>MastodonAPI</span></a></p>
Jeff Sikes<p>Here's another mastodon fever dream that is sitting in my projects pile. A mastodon bookmark browser. It extracts the authors and hashtags, and allows you to browse through them based on those filters (plus timeframes). </p><p>The problem I have right now is...for a bookmark junkie like me, once you go to "all bookmarks" the list of authors and hashtags gets unwieldy..how do I visualize the options at that point? I guess a series of dropdowns, which isn't visually appealing.</p><p><a href="https://mastodon.social/tags/MastodonAPI" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>MastodonAPI</span></a></p>
Jeff Sikes<p>I have several little sites that use the Mastodon API just sitting unfinished. Here's one that attempts to put a user friendly UI on the advanced search (elasticsearch) options if your server supports it.</p><p>"If your server supports it" is where I'm stuck. There's no /api/vX/instance or nodeinfo fields that identify if the server has it enabled.</p><p>A login is required to test for it...so I have to ask the user to login, then tell them LOL NO JK your instance doesn't support this.</p><p><a href="https://mastodon.social/tags/MastodonAPI" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>MastodonAPI</span></a></p>
Jeff Sikes<p>New API filter action in Mastodon that fedi app developers will want to know about.</p><p>Filters can now include a new filter_action of “blur”. Media attachments in posts matching the criteria should then be blurred by the client app based on the FilterResult object attached.</p><p><a href="https://docs.joinmastodon.org/methods/filters/" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">docs.joinmastodon.org/methods/</span><span class="invisible">filters/</span></a></p><p><a href="https://mastodon.social/tags/FediDev" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>FediDev</span></a> <a href="https://mastodon.social/tags/MastodonAPI" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>MastodonAPI</span></a></p>
Jeff Sikes<p>The code behind this would make good developers cry. But I have fun fiddling with it on the weekends, and have learned tons about Vue.js</p><p><a href="https://mastodon.social/tags/FediDev" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>FediDev</span></a> <a href="https://mastodon.social/tags/MastodonAPI" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>MastodonAPI</span></a></p>
Andy Piper<p>I love this blog post about fun / silly / niche apps built on the <a href="https://macaw.social/tags/MastodonAPI" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>MastodonAPI</span></a> <a href="https://halcy.de/blog/2025/03/18/silly-mastodon-apps/" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">halcy.de/blog/2025/03/18/silly</span><span class="invisible">-mastodon-apps/</span></a></p>
data0<p>I've built a thing.</p><p>Sometimes my follower count seemingly fluctuates at random. To understand why, I dug into the <a href="https://indieweb.social/tags/MastodonAPI" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>MastodonAPI</span></a> and eventually created "fedi-followers":</p><p>A privacy-friendly <a href="https://indieweb.social/tags/fediverse" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>fediverse</span></a> <a href="https://indieweb.social/tags/followers" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>followers</span></a> explorer as local-only static web app, decentrally hosted on the <a href="https://indieweb.social/tags/ipfs" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>ipfs</span></a>. See who's actually following (and unfollowing) you over time and much more.</p><p><a href="https://fedi--followers-data0-one.ipns.dweb.link/" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">fedi--followers-data0-one.ipns</span><span class="invisible">.dweb.link/</span></a></p><p><a href="https://indieweb.social/tags/mastodev" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>mastodev</span></a> <a href="https://indieweb.social/tags/javascript" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>javascript</span></a> <a href="https://indieweb.social/tags/webapp" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>webapp</span></a> <a href="https://indieweb.social/tags/staticwebapp" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>staticwebapp</span></a> <a href="https://indieweb.social/tags/nobuild" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>nobuild</span></a> <a href="https://indieweb.social/tags/esmodules" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>esmodules</span></a> <a href="https://indieweb.social/tags/importmaps" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>importmaps</span></a> <a href="https://indieweb.social/tags/nativemodules" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>nativemodules</span></a> <a href="https://indieweb.social/tags/indexeddb" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>indexeddb</span></a> <a href="https://indieweb.social/tags/preact" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>preact</span></a> <a href="https://indieweb.social/tags/htm" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>htm</span></a></p>
halcy​ :icosahedron:<p>Hey, everyone! It took like 1.5 years, here is, finally, a proper new release for Mastodon.py! 🐍 This was a lot of work! I'm so glad I finally got it across the line!</p><p>Docs: <a href="https://mastodonpy.readthedocs.io/en/2.0.0/" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">mastodonpy.readthedocs.io/en/2</span><span class="invisible">.0.0/</span></a><br>Github with changelog: <a href="https://github.com/halcy/Mastodon.py/releases/tag/2.0.0" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">github.com/halcy/Mastodon.py/r</span><span class="invisible">eleases/tag/2.0.0</span></a></p><p>This is a *massive* update. There's all the support for new endpoints up to 4.3.0, and large amounts of refactoring. The library is now fully typed, too, and thanks to that documentation has been massively improved!</p><p>Despite the major version bump, everything *should* be for the most part backward compatible. Existing code should not break, unless you're on Python 3.6 or below. I would still recommend being careful about upgrading without need. Expect a maintenance update once people actually start using this and find all the issues in the code that my tests didn't catch.</p><p><a href="https://icosahedron.website/tags/mastodonpy" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>mastodonpy</span></a> <a href="https://icosahedron.website/tags/mastodev" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>mastodev</span></a> <a href="https://icosahedron.website/tags/mastodonapi" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>mastodonapi</span></a></p>
Saaste<p>Hmm, Go:lle tuntuisi olevan vain kaksi client-kirjastoa Mastodon API:n käyttöön.<br>- <a href="https://github.com/McKael/madon" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="">github.com/McKael/madon</span><span class="invisible"></span></a><br>- <a href="https://github.com/mattn/go-mastodon" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="">github.com/mattn/go-mastodon</span><span class="invisible"></span></a></p><p>Molemmista puuttuu kaikenlaista, enkä oikein ota selvää, että ylläpidetäänkö niitä mitenkään.</p><p>Pohdin tässä nyt sitä, että alanko taas tehdä omiin tarpeisiin omaa, vai koettaisinko ensin tarjota muutoksia toiseen noista? 🤔 </p><p>Madon vaikuttaa olevan enemmän ajan tasalla ja se on myös tehty niin, että se sitä voi helposti laajentaa uusilla ominaisuuksilla. Ehkä voisin availla sinne tiketin ja tehdä sen jälkeen tarvittavat muutokset itse.</p><p><a href="https://mementomori.social/tags/ohjelmointi" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>ohjelmointi</span></a> <a href="https://mementomori.social/tags/golang" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>golang</span></a> <a href="https://mementomori.social/tags/MastodonAPI" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>MastodonAPI</span></a> <a href="https://mementomori.social/tags/programming" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>programming</span></a> <a href="https://mementomori.social/tags/AvoinL%C3%A4hdekoodi" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>AvoinLähdekoodi</span></a> <a href="https://mementomori.social/tags/OpenSource" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>OpenSource</span></a></p>
Tommi 🤯<p>Are there any <a href="https://pan.rent/tags/OpenSource" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>OpenSource</span></a> services that would allow me to cross-post on the <a href="https://pan.rent/tags/Fediverse" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Fediverse</span></a> and on <a href="https://pan.rent/tags/Bluesky" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Bluesky</span></a> <em>without</em> creating a dummy account (as <a href="https://pan.rent/tags/Bridgy" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Bridgy</span></a> does)?</p><p>Ideally, I’m thinking about a client that supports both the <a href="https://pan.rent/tags/MastodonAPI" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>MastodonAPI</span></a> and the <a href="https://pan.rent/tags/BlueskyAPI" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>BlueskyAPI</span></a>.</p><p><a href="https://pan.rent/tags/Mastodon" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Mastodon</span></a> <a href="https://pan.rent/tags/API" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>API</span></a></p>
Jupiter Rowland@<a href="https://sironi.tk/users/luca" rel="nofollow noopener noreferrer" target="_blank">Luca Sironi</a> It depends. Not everything works well frontless because not everything works well with a frontend made for Mastodon.<br><br>Hubzilla, for example, has a UI that's largely stuck in 2012. Also, it doesn't have the Mastodon client API implemented. But a frontend designed for Mastodon couldn't even cover 5% of Hubzilla's features. It would not grant access to features that are actually critical for operating a Hubzilla channel such as any parts of the permissions system.<br><br>And that's actually one of the reasons why Hubzilla doesn't have the Mastodon client API implemented: The only UI that can sufficiently harness Hubzilla's power is Hubzilla's own native Web UI.<br><br>#<a class="" href="https://hub.netzgemeinde.eu/search?tag=Long" rel="nofollow noopener noreferrer" target="_blank">Long</a> #<a class="" href="https://hub.netzgemeinde.eu/search?tag=LongPost" rel="nofollow noopener noreferrer" target="_blank">LongPost</a> #<a class="" href="https://hub.netzgemeinde.eu/search?tag=CWLong" rel="nofollow noopener noreferrer" target="_blank">CWLong</a> #<a class="" href="https://hub.netzgemeinde.eu/search?tag=CWLongPost" rel="nofollow noopener noreferrer" target="_blank">CWLongPost</a> #<a class="" href="https://hub.netzgemeinde.eu/search?tag=FediMeta" rel="nofollow noopener noreferrer" target="_blank">FediMeta</a> #<a class="" href="https://hub.netzgemeinde.eu/search?tag=FediverseMeta" rel="nofollow noopener noreferrer" target="_blank">FediverseMeta</a> #<a class="" href="https://hub.netzgemeinde.eu/search?tag=CWFediMeta" rel="nofollow noopener noreferrer" target="_blank">CWFediMeta</a> #<a class="" href="https://hub.netzgemeinde.eu/search?tag=CWFediverseMeta" rel="nofollow noopener noreferrer" target="_blank">CWFediverseMeta</a> #<a class="" href="https://hub.netzgemeinde.eu/search?tag=MastodonAPI" rel="nofollow noopener noreferrer" target="_blank">MastodonAPI</a> #<a class="" href="https://hub.netzgemeinde.eu/search?tag=Hubzilla" rel="nofollow noopener noreferrer" target="_blank">Hubzilla</a>
django<p>Are there any Mastodon API compatible clients allow connection via custom Application? <br>(Client key, client secret, Access token)</p><p>Or Some other account delegation method?</p><p><a href="https://social.coop/tags/boost" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>boost</span></a> <a href="https://social.coop/tags/mastodon" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>mastodon</span></a> <a href="https://social.coop/tags/mastodonAPI" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>mastodonAPI</span></a></p>
Terence Eden’s Blog<p><strong>Creating a generic "Log-in with Mastodon" service</strong></p><p><a href="https://shkspr.mobi/blog/2024/12/creating-a-generic-log-in-with-mastodon-service/" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">shkspr.mobi/blog/2024/12/creat</span><span class="invisible">ing-a-generic-log-in-with-mastodon-service/</span></a></p><p>Let's say you have a website - <code>your_website.tld</code> - and you want people to log in to it using their Mastodon account.</p><p>For a traditional social-media site like Twitter or Facebook, you would create an OAuth app on the service that you want. But there are <em>hundreds</em> of Mastodon servers. So you need to create a new app for each one. That sounds hard, but it isn't. Well… not <em>too</em> hard.</p><p>Here's some <a href="https://infosec.press/jerry/how-to-user-mastodons-built-on-oauth-provider-as-the-authentication-provider" rel="nofollow noopener noreferrer" target="_blank">code adapted from Infosec.press</a>. It's all written using cURL on the command line - so you should be able to adapt it to your preferred programming language.</p><p><strong>Register an app on the user's Mastodon instance</strong></p><p>Let's assume the user has given you the name of their Mastodon server - <code>example.social</code></p><p>You then send a request for an app to be created on <code>example.social</code> with your website's details. All it requests is the ability to read a user's details, nothing else.</p><pre><code>curl -X POST \ -F "client_name=Login to your_website.tld" \ -F "redirect_uris=https://your_website.tld/oauth/mastodon?server=example.social&amp;" \ -F "scopes=read:accounts" \ -F "website=https://your_website.tld" \ -A "user-agent/0.1" https://example.social/api/v1/apps</code></pre><p>You can set the User Agent to be anything suitable. Some servers won't work if it is omitted.</p><p>If the request was successful, <code>example.social</code> will send you this JSON in response:</p><pre><code>{ "id": "12345", "name": "Login to your_website.tld", "website": "https://your_website.tld", "scopes": [ "read:accounts" ], "redirect_uris": [ "https://your_website.tld/oauth/mastodon?server=example.social&amp;" ], "vapid_key": "qwertyuiop-asdfghjkl-zxcvbnm", "redirect_uri": "https://your_website.tld/oauth/mastodon?server=example.social&amp;", "client_id": "qw_asdfghjkl_zxcvbnm", "client_secret": "qwertyuiop1234567890"}</code></pre><p>Save the server's address, the <code>client_id</code>, and the <code>client_secret</code>. You will need all three later.</p><p><strong>The user logs in to their Mastodon instance</strong></p><p>You need to redirect the user to their server so they can log in. You need to construct a Mastodon URl using the data you received back. Don't forget to URl encode the <code>redirect_uri</code>.</p><p>For example, redirect the user to:</p><pre><code>https://example.social/oauth/authorize?client_id=qw_asdfghjkl_zxcvbnm&amp;scope=read:accounts&amp;redirect_uri=https://your_website.tld/oauth/mastodon%3Fserver=example.social%26&amp;response_type=code</code></pre><p>When the user visits that URl they can then log in. If they're successful, they'll be redirected back to your server using your specified redirect URI:</p><pre><code>https://your_website.tld/oauth/mastodon?server=example.social&amp;code=qazwsxedcrfvtgbyhnujm</code></pre><p><strong>Get a Bearer token</strong></p><p>Your website has received a GET request with the user's server name and an authorisation code. As per <a href="https://docs.joinmastodon.org/client/authorized/#token" rel="nofollow noopener noreferrer" target="_blank">the Mastodon documentation</a>, your app uses that code to request a Bearer token:</p><pre><code>curl -X POST \ -F "client_id=qw_asdfghjkl_zxcvbnm" \ -F "client_secret=qwertyuiop1234567890" \ -F "redirect_uri=https://your_website.tld/oauth/mastodon?server=example.social&amp;" \ -F "grant_type=authorization_code" \ -F "code=qazwsxedcrfvtgbyhnujm" \ -F "scope=read:accounts" \ -A "user-agent/0.1" https://example.social/oauth/token</code></pre><p>If that's worked, the user's server will return a Bearer token like this:</p><pre><code>{ "access_token": "abcdefg_123456", "token_type": "Bearer", "scope": "read:accounts", "created_at": 1732916685}</code></pre><p><strong>Get the user's details</strong></p><p>Finally(!) you can use that token to verify the user's credentials with the server:</p><pre><code>curl \ -H "Authorization: Bearer abcdefg_123456" \ -A "user-agent/0.1" https://example.social/api/v1/accounts/verify_credentials</code></pre><p>If that works, you'll get back all the user's details. Something like this:</p><pre><code>{ "id": "7112", "username": "Edent", "acct": "Edent", "display_name": "Terence Eden", "url": "https://mastodon.social/@Edent", "avatar": "https://files.mastodon.social/accounts/avatars/000/007/112/original/37df032a5951b96c.jpg",...}</code></pre><p><strong>Putting it all together</strong></p><ol><li>User providers their Mastodon instance's domain name</li><li>Your service looks up the domain name in its database<ul><li>If there are no results, request to create a new app on the Mastodon instance and save the returned <code>client_id</code> and <code>client_secret</code></li></ul></li><li>Redirect the User to their Mastodon instance, using a URl which contains the <code>client_id</code> &amp; callback URl</li><li>User logs in to their Mastodon instance</li><li>The User's Mastodon instance redirects the User to your service's callback URl which includes an the instance's domain name and User's authorisation code</li><li>Your service reads the User's domain name and authorisation code</li><li>Your service exchanges those details for a Bearer token</li><li>Your service uses the Bearer token to get the User's account details</li></ol><p><strong>Next steps?</strong></p><p>This basic code works. For my next trick, can I integrate it into Auth0?</p><p><a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://shkspr.mobi/blog/tag/auth0/" target="_blank">#Auth0</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://shkspr.mobi/blog/tag/mastodonapi/" target="_blank">#MastodonAPI</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://shkspr.mobi/blog/tag/oauth/" target="_blank">#oauth</a></p>
Terence Eden<p>🆕 blog! “Creating a generic "Log-in with Mastodon" service”</p><p>…</p><p>👀 Read more: <a href="https://shkspr.mobi/blog/2024/12/creating-a-generic-log-in-with-mastodon-service/" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">shkspr.mobi/blog/2024/12/creat</span><span class="invisible">ing-a-generic-log-in-with-mastodon-service/</span></a><br>⸻<br><a href="https://mastodon.social/tags/Auth0" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Auth0</span></a> <a href="https://mastodon.social/tags/MastodonAPI" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>MastodonAPI</span></a> <a href="https://mastodon.social/tags/oauth" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>oauth</span></a></p>