Fediverse is awesome! And it’s also a huge pain if you want to make a simple app that plays nice with all the different platforms it’s made up of.
Yes, there are standards, like ActivityPub, sure. But there is a lot of technologies being used to build the fediverse software, and they’re not necessarily all compatible, at least not without a bit of effort.
Here’s everything I’ve learned from my experience building my fediverse connections data visualization and other projects.
I will focus on some of the most popular platforms, and I intend to keep this article updated, so if I’m missing anything, please do let me know.
Basic server information¶
To get a link to an endpoint that shows basic information about the server, including what software it runs, and its version, whether the server is open for public signups, and more, you can send a request to /.well-known/nodeinfo
.
Here’s an example from mastodon.social, which runs Mastodon. Many, but not all platforms support the /nodeinfo/2.0
endpoint.
{
"links": [
{
"rel": "http://nodeinfo.diaspora.software/ns/schema/2.0",
"href": "https://mastodon.social/nodeinfo/2.0"
}
]
}
One more example, from stereophonic.space, a Pleroma server.
{
"links": [
{
"href": "https://stereophonic.space/nodeinfo/2.0.json",
"rel": "http://nodeinfo.diaspora.software/ns/schema/2.0"
},
{
"href": "https://stereophonic.space/nodeinfo/2.1.json",
"rel": "http://nodeinfo.diaspora.software/ns/schema/2.1"
}
]
}
Here are more examples for some of the popular fediverse platforms.
And here’s a simple example of how you might process this information.
Logging in¶
Most platforms support OAuth for logging in, with Misskey, and its clone, Firefish (previously called Calckey), being one exception. (Technically, there is a compatibility layer with Mastodon that should provide this functionality, but it doesn’t really work reliably.)
Also, do note that Pixelfed’s OAuth implementation works, but as of the writing of this article, there is a bug preventing you from making API requests once you do successfully log in.
Platform | Supported methods |
---|---|
Mastodon | OAuth |
Pleroma | OAuth |
Akkoma | OAuth |
Friendica | OAuth and basic HTTP authentication |
Diaspora | OpenID |
Misskey | MiAuth (no OAuth support) |
Firefish | MiAuth (no OAuth support) |
Peertube | A custom implementation of OAuth |
Pixelfed | OAuth |
I have a work-in-progress authentication server up on GitHub that should give you a head start implementing your own.
Scopes¶
Part of the logging-in process is providing permissions your app needs. Here’s how different platforms manage this.
Platform | Documentation |
---|---|
Mastodon | OAuth scopes |
Pleroma | Authentication & Authorization |
Akkoma | Authentication & Authorization |
Friendica | n/a |
Diaspora | Access scopes |
Misskey | The official documentation links to a non-existent page, but you can see them in the source code. |
Firefish | Same as Misskey. |
Peertube | n/a |
Pixelfed | n/a |
Getting account information¶
Once you obtain a user token, you might want to get basic information about the user logging in, like name, and their profile image.
Here’s an example with node.js for platforms that support Mastodon’s accounts/verify_credentials
API endpoint, including Mastodon, Friendica, Pleroma, and Akkoma.
const resp = await fetch(
`https://${instance}/api/v1/accounts/verify_credentials`,
{
headers: new Headers({
Authorization: `Bearer ${token}`,
}),
}
);
const respJSON = await resp.json();
const user = {
name: respJSON.display_name || respJSON.username,
username: respJSON.username,
username_full: `@${respJSON.username}@${instance}`,
avatar_url: respJSON.avatar_static,
token,
};
And here’s an example for Misskey, and its clone Firefish (previously Calckey).
const resp = await fetch(`https://${instance}/api/i`, {
headers: {
"content-type": "application/json",
},
body: JSON.stringify({
i: token,
}),
method: "POST",
});
const respJSON = await resp.json();
const user = {
name: respJSON.name,
username: respJSON.username,
username_full: `@${respJSON.username}@${instance}`,
avatar_url: respJSON.avatarUrl,
token,
};
Sharing dialog¶
Some platforms allow you to link to a page that lets you prefill a message before sharing it. Remember to URI encode any parameters you’re passing to the sharing URL (example with JavaScript).
Platform | Example share URL |
---|---|
Mastodon | https://mastodon.social/share?text=TEXT |
Pleroma | n/a |
Akkoma | n/a |
Friendica | n/a |
Diaspora | https://podington.oksocial.net/bookmarklet?url=URL&title=TITLE¬e=NOTE |
Misskey | https://misskey.id/share?text=TEXT |
Firefish | https://firefish.social/share?text=TEXT |
Peertube | n/a |
Pixelfed | n/a |
Embedding posts¶
This section is work in progress. See also my Fediverse Embeds plugin.
I'm looking into embedding fediverse posts and I see that out of the major platforms, only Mastodon and Peertube support embedding via iframes.
Some of the platforms should at least support oEmbed, but I can't seem to get this to work.
Does anyone know more about this?
#fediverse #oembed #embed #mastodon #pleroma #akkoma #friendica #diaspora #misskey #calckey #peertube #pixelfed
Platform | Embed support | oEmbed URL |
---|---|---|
Mastodon | iframe, oEmbed | https://mastodon.social/api/oembed?url=URL |
Pleroma | n/a | n/a |
Akkoma | n/a | n/a |
Friendica | n/a | n/a |
Diaspora | n/a | n/a |
Misskey | no | n/a |
Firefish | no | n/a |
Peertube | iframe, oEmbed | https://urbanists.video/services/oembed?url=URL |
Pixelfed | iframe | n/a |
Tags¶
This section is work in progress.
Platform | Tag | Profile tag |
---|---|---|
Mastodon | https://mastodon.social/tags/fediverse | https://mastodon.social/@mastodon/tagged/mastodon |
Pleroma | n/a | n/a |
Akkoma | n/a | n/a |
Friendica | n/a | n/a |
Diaspora | n/a | n/a |
Misskey | n/a | n/a |
Firefish | n/a | n/a |
Peertube | n/a | n/a |
Pixelfed | n/a | n/a |
RSS feeds¶
This section is work in progress.
Platform | Profile | Tags |
---|---|---|
Mastodon | https://mastodon.social/@mastodon.rss | https://mastodon.social/@mastodon/tagged/mastodon.rss |
Pleroma | https://blob.cat/users/stefanbohacek/feed.rss | n/a |
Akkoma | https://mycrowd.ca/users/stefanbohacek/feed.rss | n/a |
Friendica | n/a | n/a |
Diaspora | n/a | n/a |
Misskey | n/a | n/a |
Firefish | n/a | n/a |
Peertube | n/a | n/a |
Pixelfed | n/a | n/a |
Mastodon compatibility¶
While there actually is an ActivityPub client-server standard called ActivityPub Client-to-Server (or AP C2S, thanks to @unexpectedteapot for the heads-up), it is not widely adopted. Instead, some platforms opted for increased compatibility with Mastodon (link to documentation) and support several of the endpoints.
Platform | Mastodon compatibility |
---|---|
Pleroma | – differences in Mastodon API responses |
Akkoma | – differences in Mastodon API responses |
Friendica | – login via OAuth works the same – Friendica supports many of the same API endpoints |
Diaspora | n/a |
Misskey | n/a |
Firefish | Mastodon API layer via plugins, spotty OAuth compatibility |
Peertube | n/a |
Pixelfed | n/a |
Official documentation¶
Platform | Documentation |
---|---|
Mastodon | – Getting started with the API – APIs |
Pleroma | – Pleroma API |
Akkoma | – Akkoma Documentation |
Friendica | – Friendica API |
Diaspora | – diaspora* API documentation |
Misskey | – Misskey API |
Firefish | – Firefish API |
Peertube | – PeerTube documentation |
Pixelfed | – Pixelfed Documentation – Pixelfed API Reference |
More resources¶
- Fedidocs: example payloads and notes about different fediverse platforms
Usually I polish my work a bit more before releasing it publicly, but I really wanted to give people interested in making fediverse apps for everyone a bit of a head start.
Here's a very work-in-progress authentication server I use for my fediverse connections data visualization project:
https://github.com/stefanbohacek/auth-server
#fediverse #mastodon #calckey #oauth #authentication #nodejs #development
And here's a few things I learned along the way.
https://stefanbohacek.com/blog/making-fediverse-apps-for-everyone
I hope this is all useful, and I'll welcome any help to make these better!