Skip to main content

Connect

Establishes a connection to Microsoft Graph API using OAuth2 credentials. This node authenticates with Microsoft's cloud services and creates a session that can be used with other Microsoft Graph nodes.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is set to true, no error is caught when the project is executed even if a Catch node is used.

Output

  • Client Id - A unique identifier for this connection session. Pass this ID to other Microsoft Graph nodes to use the same authenticated session.

Options

  • Credentials - OAuth2 credentials document from the vault containing authentication information.

The credentials document must contain:

  • client_id: Your Azure AD application (client) ID
  • client_secret: Your Azure AD application secret
  • tenant_id: Your Azure AD tenant ID (optional, defaults to "common")
  • access_token: OAuth2 access token (auto-populated after first connection)
  • refresh_token: OAuth2 refresh token (auto-populated after first connection)
  • expires_at: Token expiration timestamp (auto-populated)

How It Works

The Connect node intelligently handles authentication:

  1. Token Reuse: If a valid access token exists in the credentials and hasn't expired, it's reused immediately
  2. Token Refresh: If the access token is expired but a refresh token exists, it automatically refreshes the token
  3. OAuth2 Flow: If no refresh token exists, it opens a browser window for you to authenticate with Microsoft

The node automatically updates your vault credentials with fresh tokens, so subsequent connections are faster.

Example

Basic Connection:

1. Create a vault item with your Azure AD credentials:
{
"client_id": "your-app-id",
"client_secret": "your-app-secret",
"tenant_id": "common"
}

2. Use Connect node with the credentials
3. The Client Id output (e.g., "a1b2c3d4-...") is passed to other nodes

Workflow Pattern:

Connect → Get Workbook → Get Range → Set Cell Value → Disconnect

Required Permissions

Your Azure AD application needs these Microsoft Graph API permissions:

  • Files.ReadWrite.All - Access files in OneDrive
  • Sites.ReadWrite.All - Access SharePoint sites
  • offline_access - Get refresh tokens for long-running automations

Tips

  • Store credentials securely in Robomotion vault, never hardcode them
  • The same credentials can be used for multiple parallel connections
  • Connections remain active until Disconnect is called or the flow ends
  • For better performance, reuse a single connection across multiple operations

Common Errors

ErrInvalidArg - "Could not get client_id"

  • Solution: Ensure your credentials document contains a valid client_id field

ErrInvalidArg - "Could not get client_secret"

  • Solution: Ensure your credentials document contains a valid client_secret field

ErrAuth - "Failed to get authorization code from OAuth flow"

  • Solution: Complete the OAuth login when the browser window opens

ErrCredentials - "Token refresh failed"

  • Solution: The refresh token may be invalid. Delete the refresh_token field from your credentials to trigger a new OAuth flow