Overview
Inventario integrates with multiple third-party services to provide authentication, notifications, and AI-powered features. This guide covers configuration and usage of these integrations.Google OAuth Setup
Inventario uses django-allauth to enable Google OAuth authentication, allowing users to sign in with their Google accounts.Configuration
The Google OAuth integration is configured insettings.py:
inventario/settings.py
Environment Variables
Add these variables to your.env file:
Obtaining Google OAuth Credentials
Create Google Cloud Project
Go to Google Cloud Console and create a new project or select an existing one.
Create OAuth Credentials
Go to APIs & Services > Credentials and click Create Credentials > OAuth client ID.
- Application type: Web application
- Authorized redirect URIs:
https://yourdomain.com/accounts/google/login/callback/
Custom Social Account Adapter
Inventario implements a custom adapter inapplications/cuentas/adapters.py that:
- Blocks inactive users from logging in via Google
- Downloads profile photos from Google accounts (high resolution)
- Connects existing accounts by email matching
- Creates new accounts with admin approval required (inactive by default)
applications/cuentas/adapters.py
User Flow
Google returns with user data
If email matches existing account → Login directly (if active)If new user → Create account as inactive, require admin approval
API Configuration
Django REST Framework
Inventario can be extended with API endpoints using Django REST Framework. Current authentication backends:settings.py
CSRF Protection
For external API access, configure trusted origins:settings.py
.env:
Database Configuration
Inventario uses dj-database-url for flexible database configuration:settings.py
Supported Databases
SetDATABASE_URL in your .env file:
Media & Static Files
Inventario uses WhiteNoise for static file serving in production:settings.py
Security Settings
Production Configuration
settings.py
Environment Variables
.env
Testing Integrations
Google OAuth
Test the OAuth flow:- Navigate to
/accounts/google/login/ - Complete Google sign-in
- Verify redirect to dashboard or registration confirmation
Local Development
For local development, addhttp://127.0.0.1:8000 to your Google OAuth redirect URIs:
Troubleshooting
OAuth redirect mismatch error
OAuth redirect mismatch error
Ensure your redirect URI in Google Cloud Console exactly matches:Include the trailing slash and correct protocol (https in production).
User created but cannot login
User created but cannot login
Check if the user is marked as active in Django admin:
Profile photo not downloading
Profile photo not downloading
The adapter only downloads real Google profile photos (not default avatars).Photos are saved to
media/fotos_perfil/google_profile_username.jpgCheck logs for photo download status.Next Steps
Notifications
Configure email and SMS notifications
AI Features
Enable OpenAI-powered insights