# Mastodon

Authorize an account on its Mastodon instance.

URL: /docs/providers/mastodon

You need an account on a Mastodon instance and a Mastodon channel in your project.
Postdot registers its OAuth application with the chosen instance during connection;
you do not need to manually create a global provider application in Postdot.

## Connect [#connect]

1. Open the channel in **Channels** and start its connection.
2. Enter the **Mastodon instance URL**, such as `https://mastodon.social`. Use the
   instance origin, without a profile path, user name or query string.
3. Continue to Mastodon and authorize the account you want to publish from.
4. Return to Studio and verify the connected account and instance.

Postdot requests `read:accounts`, `write:media` and `write:statuses`. These cover
account verification, attachment upload and status publication. The instance must
allow application registration and the requested access.

For a public installation, configure Postdot's HTTPS origin before connecting.
The callback is `/api/oauth/mastodon/callback` on that origin; Postdot registers
it as part of the flow. Changing the instance's public origin afterwards can
require a new connection.

## If the connection fails [#if-the-connection-fails]

An invalid instance error usually means the input includes something other than
an origin. Application registration can also fail because the instance is
unreachable, rejects the registration or is refused by Postdot's network policy.
Do not weaken that policy to make an untrusted address work.

If you selected the wrong account, disconnect that channel's publisher and connect
again with the intended account. If authorization expired or was declined, start
a fresh flow from the channel rather than reusing the callback address.

Instance limits can differ. Review the destination's text and media validation
before scheduling; connection alone does not prove a particular upload will work.

Mastodon documents its [authorization flow](https://docs.joinmastodon.org/client/authorized/)
and [OAuth scopes](https://docs.joinmastodon.org/api/oauth-scopes/).

