Overview
This node manages iFood authentication tokens by interacting with a database to store, validate, clean up, and retrieve token information. It supports multiple database types including MySQL, PostgreSQL, SQLite, and MongoDB. Common use cases include securely storing OAuth tokens for iFood API access, validating token expiry, cleaning expired tokens from the database, and retrieving token details for client applications.
Use Case Examples
- An application that needs to authenticate with iFood API and store the OAuth tokens securely in a MySQL database for reuse.
- A workflow that periodically validates stored tokens to ensure they are still valid before making API calls.
- A maintenance task that cleans up expired tokens from the database to keep it tidy.
- Retrieving stored token information to monitor token expiry and refresh status.
Properties
| Name | Meaning |
|---|---|
| Database Connection | Type of database to connect to for storing tokens (MySQL, PostgreSQL, SQLite, MongoDB). |
| Database Host | Hostname or IP address of the database server (not applicable for SQLite). |
| Database Port | Port number for the database connection, varies by database type (MySQL: 3306, PostgreSQL: 5432, MongoDB: 27017). |
| Database Name | Name of the database where tokens are stored. |
| Database User | Username for authenticating to the database (not applicable for SQLite). |
| Database Password | Password for authenticating to the database (not applicable for SQLite). |
| Database File Path | File path for SQLite database file (only applicable for SQLite). |
| Table/Collection Name | Name of the table or collection in the database where tokens are stored. |
| Client Identifier | Unique identifier for the client/application to distinguish tokens; defaults to clientId from credentials if empty. |
Output
JSON
operation- The operation performed (e.g., getInfo).success- Indicates if the operation was successful.timestamp- Timestamp of when the operation was performed.clientId- Client identifier used for the token.exists- Indicates if a token exists for the client (only for getInfo).isExpired- Indicates if the token is expired (only for getInfo).createdAt- Timestamp when the token was created (only for getInfo).expiresAt- Timestamp when the token expires (only for getInfo).tokenType- Type of the token (e.g., Bearer).hasRefreshToken- Indicates if a refresh token is available.timeUntilExpiry- Seconds remaining until token expiry (only for getInfo).message- Informational message about the operation result.
Dependencies
- Requires an API key credential for iFood API authentication.
- Requires database drivers for MySQL, PostgreSQL, SQLite, or MongoDB depending on the selected database connection type.
Troubleshooting
- Ensure the correct database driver packages are installed for the selected database type; otherwise, the node will throw errors indicating missing drivers.
- Verify database connection parameters (host, port, user, password, database name) are correct to avoid connection failures.
- If using SQLite, ensure the database file path is accessible and writable.
- Common error messages include 'Unsupported database connection' if an invalid database type is selected, or 'Failed to save/get/delete token from database' indicating issues with database operations.
- For OAuth token retrieval, ensure the correct grant type and required parameters (authorization code, refresh token) are provided to avoid authentication errors.
Links
- iFood API Documentation - Official documentation for iFood API and authentication.
- n8n Credentials Documentation - Information on how to configure API credentials in n8n.