iFood Login icon

iFood Login

Manage iFood authentication tokens with database storage

Overview

This node manages iFood authentication tokens by performing login operations and storing the tokens in a specified database. It supports multiple database types including MySQL, PostgreSQL, SQLite, and MongoDB. The node can log in to iFood using OAuth credentials, store the access and refresh tokens securely in the database, validate stored tokens, clean up expired tokens, and retrieve stored token information. This is useful for workflows that require persistent and secure management of iFood API tokens, enabling seamless API access without repeated manual authentication.

Use Case Examples

  1. A workflow that logs in to iFood, stores the token in a MySQL database, and uses the token for subsequent API calls.
  2. A workflow that validates the stored token before making API requests to ensure the token is still valid.
  3. A scheduled workflow that cleans up expired tokens from the database to maintain token hygiene.

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 used 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 to use for storing tokens.
Database User Username for authenticating to the database (not used for SQLite).
Database Password Password for authenticating to the database (not used for SQLite).
Database File Path File path for SQLite database file (only used if SQLite is selected).
Table/Collection Name Name of the table or collection where tokens will be stored.
Client Identifier Unique identifier for the client/application; if empty, the clientId from credentials is used.

Output

JSON

  • operation - The operation performed (e.g., login).
  • success - Indicates if the operation was successful.
  • timestamp - Timestamp of when the operation was performed.
  • clientId - Client identifier used for the token.
  • message - Informational message about the operation result.
  • tokenType - Type of the token (e.g., Bearer).
  • expiresIn - Token expiration duration in seconds.
  • expiresAt - ISO timestamp when the token expires.
  • hasRefreshToken - Boolean indicating if a refresh token is available.

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 that the database connection parameters (host, port, user, password, database name) are correct and accessible from the n8n environment.
  • If using SQLite, ensure the file path is correct and writable.
  • Check that the iFood API credentials are valid and have the necessary permissions for OAuth token retrieval.
  • Common error messages include unsupported grant types, missing authorization code or refresh token for respective OAuth flows, and database operation failures due to connection or query issues.

Links

Discussion