This guide walks you through setting up OAuth 2.0 and all API integrations for CoreAI.
OAuth 2.0 gives your agents full access to user's Google Calendar, Gmail, and Meet.
- Go to Google Cloud Console
- Click "Select a Project" β "New Project"
- Name:
CoreAIβ Click "Create" - Wait for project creation, then select it
- Go to "APIs & Services" β "Library"
- Search and enable these APIs (click "Enable" for each):
- β Google Calendar API
- β Gmail API
- β Google Meet API (part of Calendar API)
- Go to "APIs & Services" β "OAuth consent screen"
- Choose "External" β Click "Create"
- Fill in the form:
App name: CoreAI User support email: [your email] App logo: [optional] Developer contact info: [your email] - Click "Save and Continue"
- Click "Add or Remove Scopes"
- Add these scopes manually:
https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/calendar.events https://www.googleapis.com/auth/gmail.readonly https://www.googleapis.com/auth/gmail.send https://www.googleapis.com/auth/gmail.modify - Or filter and select:
- Calendar API: All scopes
- Gmail API: Read, send, and modify
- Click "Update" β "Save and Continue"
- Click "Add Users"
- Add your Gmail address
- Click "Save and Continue"
- Review and click "Back to Dashboard"
- Go to "Credentials" β "Create Credentials" β "OAuth client ID"
- Application type: "Desktop app" (easiest for local development)
- Or choose "Web application" for production
- Name:
CoreAI Desktop Client - Click "Create"
- After creation, you'll see your credentials
- Click "Download JSON"
- Save the file
Option A: Use JSON file (Recommended)
# Move downloaded file to CoreAI directory
mv ~/Downloads/client_secret_*.json backend/agentic/credentials.jsonOption B: Use Environment Variables
Open the downloaded JSON file and copy the values to .env:
# Open backend/agentic/.env and add:
GOOGLE_CLIENT_ID=123456789-abcdefg.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=GOCSPX-your_client_secret_here
GOOGLE_REDIRECT_URI=http://localhost:8080cd backend/agentic
source venv/bin/activate # or venv\Scripts\activate on Windows
python main.pyFirst time running:
- A browser window will open
- Sign in with your Google account
- Grant permissions
- Close the browser
- Credentials are saved in
token.pickle
Future runs:
- Automatically uses saved credentials
- No browser window needed
Why: Free tier is generous (60 calls/min), reliable, comprehensive data
-
Sign Up
- Go to OpenWeatherMap
- Click "Sign Up"
- Verify your email
-
Get API Key
- Go to API Keys
- Copy your default API key
- Or create a new one
-
Add to .env
WEATHER_API_KEY=your_openweathermap_api_key_here WEATHER_API_PROVIDER=openweathermap WEATHER_API_UNITS=metric
-
Test
# In Python console from utils.api_clients import get_weather_client client = get_weather_client() weather = client.get_current_weather("New York") print(weather)
Why: Even more generous free tier (1M calls/month)
-
Sign Up
- Go to WeatherAPI.com
- Click "Sign Up Free"
-
Get API Key
- Dashboard β "Copy" your API key
-
Add to .env
WEATHER_API_KEY=your_weatherapi_key_here WEATHER_API_PROVIDER=weatherapi WEATHER_API_UNITS=metric
-
Sign Up
- Go to NewsAPI.org
- Click "Get API Key"
- Fill in the form (choose Developer plan - it's free)
-
Get API Key
- Check your email for activation
- Login and go to Account
- Copy your API key
-
Add to .env
NEWS_API_KEY=your_newsapi_key_here NEWS_API_COUNTRY=us NEWS_API_LANGUAGE=en
-
Free Tier Limits
- 100 requests per day
- 7-day news history
- Upgrade to paid for more
-
Test
from utils.api_clients import get_news_client client = get_news_client() news = client.get_top_headlines(limit=5) print(news)
These are nice-to-have but not required:
- Go to Slack API
- "Create New App" β "From scratch"
- Add to workspace
- Get Bot Token (
xoxb-...) - Add to
.env:SLACK_BOT_TOKEN=xoxb-your-token
- Go to Azure Portal
- Register application
- Get credentials
- Add to
.env:MICROSOFT_APP_ID=your_app_id MICROSOFT_APP_PASSWORD=your_password
- Go to Notion Integrations
- "New integration"
- Get token
- Add to
.env:NOTION_API_KEY=secret_your_token
After setup, verify everything works:
- GOOGLE_API_KEY - Working
- SERPER_API_KEY - Working
- OAuth flow completes successfully
-
token.picklefile created - No errors in console
- WEATHER_API_KEY added
- Test query returns real data
- No "simulated data" message
- NEWS_API_KEY added
- Test query returns real articles
- No "simulated data" message
cd backend/agentic
python -c "
from utils.api_clients import get_weather_client, get_news_client
from utils.oauth_helper import get_calendar_service
# Test Weather
weather = get_weather_client()
print('Weather:', weather.get_current_weather('London'))
# Test News
news = get_news_client()
print('News:', news.get_top_headlines(limit=3))
# Test OAuth
calendar = get_calendar_service()
print('Calendar:', 'Connected' if calendar else 'Not configured')
"Start CoreAI and try these:
User: What's the weather in Tokyo?
Expected: Real weather data (if API configured) or simulated data
User: What's in the news?
Expected: Real headlines (if API configured) or simulated data
-
Never commit
.envfile# Already in .gitignore, but double-check: echo ".env" >> .gitignore echo "token.pickle" >> .gitignore echo "credentials.json" >> .gitignore
-
Rotate API keys regularly
- Every 3-6 months for development
- More frequently for production
-
Use environment-specific keys
- Different keys for dev/staging/prod
- Never use production keys in development
-
Restrict API key permissions
- In Google Cloud Console, restrict by IP
- In OpenWeatherMap, enable domain restrictions
-
Monitor API usage
- Check dashboards regularly
- Set up alerts for unusual activity
"redirect_uri_mismatch"
- Solution: Add
http://localhost:8080to authorized redirect URIs
Browser doesn't open
- Solution: Copy the URL from terminal and open manually
"Access blocked: This app's request is invalid"
- Solution: Add your email to test users in OAuth consent screen
Weather: "Invalid API key"
- Check the key is copied correctly (no extra spaces)
- Verify key is activated (can take 10 minutes)
News: "Rate limit exceeded"
- Free tier: 100 requests/day
- Wait until reset or upgrade plan
"Module not found"
cd backend/agentic
source venv/bin/activate
pip install -r requirements.txt- Google OAuth 2.0 Guide
- OpenWeatherMap API Docs
- NewsAPI Documentation
- Google Calendar API
- Gmail API Guide
Once configured, your agents will:
- β Access real Google Calendar data
- β Send and read real Gmail
- β Fetch real weather forecasts
- β Show actual news headlines
Important: The app works great even without these APIs! It will use simulated data for testing, and you can add real APIs later.
Need help? Check the main SETUP_GUIDE.md or open an issue on GitHub.