Instagram Auth icon

Instagram Auth

Handle Instagram authentication

Overview

The Submit 2FA Code operation of the Instagram Auth node is designed to complete the two-factor authentication (2FA) process for Instagram accounts. This step is typically required after an initial login attempt that triggers a 2FA challenge, such as when logging in from a new device or location. The node allows users to submit their 2FA code—received via SMS or generated by an authenticator app (TOTP)—to authenticate and establish a session with Instagram.

Common scenarios:

  • Automating Instagram account logins that require 2FA.
  • Integrating Instagram actions into workflows where secure authentication is necessary.
  • Handling login flows in environments with enhanced security requirements.

Practical example:
A user attempts to log in to Instagram via n8n, receives a 2FA challenge, and uses this node to submit the received code, completing the authentication and enabling further automated actions.


Properties

Display Name Type Description
2FA Code String Two-factor authentication code from SMS or TOTP (Google Authenticator). Required.
Verification Method Options Method to use for verification:
- SMS: Use SMS verification
- TOTP (Google Authenticator): Use TOTP verification. Default is TOTP.
Trust This Device Boolean Whether to trust this device for future logins. Default: true.
Two Factor Identifier String Two factor identifier from previous login step.
Username String Username from previous login step.

Note:

  • "Two Factor Identifier" and "Username" are usually provided by the output of a previous Login operation that indicated a 2FA requirement.
  • If not explicitly set, "Username" defaults to the username from credentials.

Output

The node returns a JSON object with the following structure:

{
  "success": true,
  "authenticated": true,
  "userId": "<Instagram User ID>",
  "sessionData": { /* Serialized session data */ },
  "requiresTwoFactor": false,
  "user": { /* Instagram user object (details depend on API response) */ }
}

Fields:

  • success (boolean): Indicates if the operation was successful.
  • authenticated (boolean): True if authentication succeeded.
  • userId (string): Instagram user ID.
  • sessionData (object): Serialized session data for future authenticated requests.
  • requiresTwoFactor (boolean): False if 2FA was completed successfully.
  • user (object): Details about the authenticated Instagram user.

On error, the output may include:

{
  "success": false,
  "error": "<Error message>"
}

Dependencies

  • External Service: Instagram account with 2FA enabled.
  • API Key/Credentials: Requires valid Instagram credentials configured in n8n under "instagramPrivateApi".
  • n8n Configuration: No special configuration beyond credentials.
  • npm Dependency: Uses the instagram-private-api package.

Troubleshooting

Common Issues

  • Missing 2FA Code:
    Error: "Two-factor code is required"
    Resolution: Ensure you provide the code received via SMS or authenticator app.

  • Missing Two Factor Identifier:
    Error: "Two-factor identifier is required. Please connect this node to the output of a Login node that returned a 2FA requirement."
    Resolution: Make sure to pass the output from a Login operation that triggered 2FA.

  • Missing Username:
    Error: "Username is required. Please connect this node to the output of a Login node that returned a 2FA requirement."
    Resolution: Provide the username, either manually or from the previous Login node's output.

  • Session Capture Timeout:
    Error: "Session capture timeout"
    Resolution: Retry the operation; ensure network connectivity and that Instagram is accessible.

  • Invalid or Expired 2FA Code:
    Error message will be included in the error field of the output.
    Resolution: Double-check the code and try again promptly.

General Tips

  • Always chain this node after a Login node that indicates a 2FA requirement.
  • Save the sessionData output for future sessions to avoid repeated logins.

Links and References

Discussion