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 validity before making API calls, cleaning expired tokens to maintain database hygiene, and retrieving token details for monitoring or debugging.
Use Case Examples
- An application that needs to authenticate with iFood API can use this node to login and store the token securely in a database.
- Before making API requests, the node can validate if the stored token is still valid to avoid authentication errors.
- Periodically clean up expired tokens from the database to keep it optimized.
- Retrieve stored token information to check expiry times and token types for audit purposes.
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. |
| Database Name | Name of the database where tokens are stored. |
| Database User | Username for authenticating with the database (not applicable for SQLite). |
| Database Password | Password for authenticating with 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 (login, validate, cleanup, getInfo).success- Indicates if the operation was successful.timestamp- Timestamp 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) for login and getInfo operations.expiresIn- Token expiry duration in seconds (for login operation).expiresAt- ISO timestamp when the token expires.hasRefreshToken- Boolean indicating if a refresh token is available.isValid- Boolean indicating if the stored token is valid (for validate operation).expiredAt- Timestamp when the token expired and was removed (for validate operation).timeUntilExpiry- Seconds remaining until token expiry (for validate and getInfo operations).deletedCount- Number of expired tokens deleted (for cleanup operation).exists- Boolean indicating if a token exists for the client (for getInfo operation).isExpired- Boolean indicating if the token is expired (for getInfo operation).createdAt- Timestamp when the token was created (for getInfo operation).error- Error message if the operation failed.
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, SQL or MongoDB operations will fail with an error.
- 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.
- Check that the client identifier is unique or correctly set to avoid token overwrites or retrieval issues.
- Common errors include unsupported grant types, missing authorization codes or refresh tokens for OAuth, and unsupported database connection types.
- If token validation fails, verify token expiry and refresh token availability.