Mastodon icon

Mastodon

Interact with Mastodon API

Overview

This node facilitates interaction with the Mastodon API, specifically supporting OAuth2 authentication flows among many other Mastodon-related operations. The "Authentication - Obtain Token" operation allows users to exchange an OAuth authorization code for an access token from a specified Mastodon instance. This is essential in scenarios where you want to programmatically authenticate and authorize your application to act on behalf of a user.

Practical examples include:

  • Automating the process of obtaining an access token after a user authorizes your app via OAuth.
  • Integrating Mastodon login flows into custom workflows.
  • Setting up subsequent Mastodon API calls that require authenticated access.

Properties

Name Meaning
Mastodon URL The base URL of the Mastodon instance you want to connect to (e.g., https://mastodon.social).
Client ID The OAuth client identifier issued when registering your application with the Mastodon instance.
Client Secret The OAuth client secret associated with your client ID, used to authenticate your app securely.
Authorization Code The code received from the OAuth authorization step, which will be exchanged for an access token.
Redirect URI The redirect URI registered with the Mastodon app, must match exactly to complete the OAuth flow. Default is urn:ietf:wg:oauth:2.0:oob.

Output

The output JSON contains the response from the Mastodon OAuth token endpoint. Typically, this includes:

  • access_token: The OAuth access token to use for authenticated requests.
  • token_type: Usually "Bearer".
  • scope: The scopes granted by the token.
  • created_at: Timestamp of token creation.
  • Possibly other OAuth token metadata depending on the Mastodon instance's response.

This output enables downstream nodes or workflows to use the access token for further Mastodon API interactions.

Dependencies

  • Requires a valid Mastodon instance URL.
  • Requires OAuth client credentials (Client ID and Client Secret) obtained by registering an app on the Mastodon instance.
  • The node expects these credentials to be provided as input parameters.
  • No additional external dependencies beyond standard HTTP requests to the Mastodon API.

Troubleshooting

  • Invalid Client Credentials: If the client ID or secret is incorrect, the token request will fail. Verify your app registration details.
  • Mismatched Redirect URI: The redirect URI must exactly match what was registered with the Mastodon app; otherwise, the token exchange will be rejected.
  • Expired or Invalid Authorization Code: The authorization code can only be used once and expires quickly. Ensure you use a fresh code obtained from the OAuth authorization step.
  • Network Issues: Connectivity problems to the Mastodon instance URL will cause failures. Confirm the URL is reachable.
  • Error Messages: The node may throw errors if the operation is not implemented or if required parameters are missing. Check that all required properties are set correctly.

To resolve issues, double-check all OAuth parameters, ensure the Mastodon instance URL is correct, and verify network connectivity.

Links and References

Discussion