Mastodon icon

Mastodon

Interact with Mastodon API

Actions115

Authentication → Obtain Token

AI-generated

Overview

This node operation handles obtaining an OAuth2 token for authenticating with a Mastodon instance. It is used when integrating Mastodon API access into workflows, allowing secure OAuth2 authentication by exchanging an authorization code for an access token. This is essential for scenarios where users need to authenticate via OAuth2 to perform actions on Mastodon on their behalf.

Use Case Examples

  1. A user configures the node with their Mastodon instance URL, OAuth2 client ID, client secret, authorization code, and redirect URI to obtain an access token for subsequent API calls.
  2. Automating Mastodon posting or data retrieval by first obtaining an OAuth2 token programmatically within an n8n workflow.

Properties

Name Meaning
Mastodon URL URL of the Mastodon instance to connect to, used as the base URL for authentication requests.
Authentication Type Method of authentication to use; must be OAuth2 for obtaining a token in this operation.
Client ID OAuth client ID required for the OAuth2 token request.
Client Secret OAuth client secret required for the OAuth2 token request.
Authorization Code Code received from the OAuth authorization step, used to exchange for an access token.
Redirect URI Redirect URI that matches the app registration, required for OAuth2 token exchange.

Output

JSON

  • json - The JSON object containing the obtained OAuth2 token and related authentication data.

Dependencies

  • Requires OAuth2 credentials including client ID, client secret, and authorization code obtained from Mastodon OAuth authorization flow.

Troubleshooting

  • Error if OAuth2 credentials are missing or invalid: Ensure that the OAuth2 client ID, client secret, and authorization code are correctly provided.
  • Error if Authentication Type is not OAuth2: This operation requires OAuth2 authentication type; selecting Access Token will cause an error.
  • If the Mastodon URL is incorrect or unreachable, the token request will fail; verify the URL is correct and the instance is accessible.

Discussion