Auth Code
Implements the OAuth 2.0 Authorization Code flow for obtaining access tokens.
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 true, no error is caught when the project is executed, even if a Catch node is used.
Options
- Credentials - OAuth 2.0 credentials containing client_id, client_secret, token_uri, and optionally auth_uri, redirect_url, scopes, refresh_token, and access_token.
Output
- access_token - The OAuth 2.0 access token obtained through the authorization flow.
How It Works
The Auth Code node implements the OAuth 2.0 Authorization Code flow to obtain access tokens. When executed, the node:
- Retrieves the OAuth 2.0 credentials from the configured credential store
- Validates the required credential fields (client_id, client_secret, token_uri)
- Checks if an auth_uri is provided:
- If present, initiates the full OAuth 2.0 authorization flow using a browser dialog
- If not present, uses a refresh token to obtain a new access token
- Updates the credential store with the new token information
- Returns the access token as output
Requirements
- Valid OAuth 2.0 credentials with client_id and client_secret
- For authorization flow: auth_uri, redirect_url, and scopes must be provided
- For refresh flow: refresh_token must be provided
- Network connectivity to the OAuth 2.0 provider's endpoints
Error Handling
The node will return specific errors in the following cases:
- Missing or invalid credential configuration
- Missing required credential fields (client_id, client_secret, token_uri)
- Missing auth_uri when attempting authorization flow
- Missing refresh_token when attempting refresh flow
- Empty or invalid scopes array
- OAuth 2.0 provider errors during token exchange
- Network connectivity issues
Usage Notes
- The node automatically handles token refresh when the current token expires
- Credential information is updated in the credential store after each successful token exchange
- For security, access tokens and refresh tokens are stored encrypted in the credential store
- The authorization flow requires user interaction through a browser dialog
- The redirect URL must be properly configured in your OAuth 2.0 provider's settings