How shan1412/customgpt_middleware_app works
This is a FastAPI middleware service connecting CustomGPT actions with Salesforce OAuth and account access. The documented user journey is to authenticate through Salesforce, then use bearer-token actions to retrieve records and save responses; account retrieval is a separate Salesforce-backed action. The graph includes OAuth/token handling, authorization and refresh, and the two persistence paths. Note that the sampled CustomGPT routes currently return anonymous/sample data rather than applying the README-described authentication; unsampled route behavior is not inferred.
Main entry points: action_routes.py Account Action · auth_routes.py OAuth Routes · db.py Token Database · main.py FastAPI Application
Components 14
API and Actions
- CustomGPT Actions
routes/customgpt_routes.py - FastAPI Application
main.py - Account Action
routes/action_routes.py
OAuth and Identity
- OAuth Routes
routes/auth_routes.py - Bearer Validator
auth/validator.py - JWT Handler
auth/jwt_handler.py - Salesforce OAuth
auth/salesforce.py
Salesforce Access
- Token Refresh
auth/token_refresh.py - Account API Client
services/salesforce_service.py
Persistence and Audit
- Token Database
services/db.py - Response Workbook
services/excel_service.py - Audit and Error Logs
utils/logger.py
Other components
- CustomGPT User
- Salesforce
Connections 23
- FastAPI Application → OAuth Routes: registers routes
main.py - FastAPI Application → Account Action: registers routes
main.py - FastAPI Application → CustomGPT Actions: registers routes
main.py - FastAPI Application → Token Database: initializes
main.py - CustomGPT User → OAuth Routes: starts login
README.md - OAuth Routes → Salesforce OAuth: builds login URL
routes/auth_routes.py - OAuth Routes → Salesforce OAuth: exchanges code
routes/auth_routes.py - OAuth Routes → Token Database: saves tokens
routes/auth_routes.py - OAuth Routes → JWT Handler: issues JWT
routes/auth_routes.py - Salesforce OAuth → Salesforce: requests OAuth tokens
auth/salesforce.py - CustomGPT User → CustomGPT Actions: calls actions
README.md - CustomGPT Actions → Response Workbook: appends response
routes/customgpt_routes.py - CustomGPT User → Account Action: requests accounts
routes/action_routes.py - Account Action → Bearer Validator: validates bearer token
routes/action_routes.py - Bearer Validator → JWT Handler: decodes JWT
auth/validator.py - Bearer Validator → Token Database: checks user token
auth/validator.py - Account Action → Token Database: reads token
routes/action_routes.py - Account Action → Token Refresh: refreshes expired token
routes/action_routes.py - Token Refresh → Token Database: reads and updates
auth/token_refresh.py - Token Refresh → Salesforce: requests refresh
auth/token_refresh.py - Account Action → Account API Client: fetches accounts
routes/action_routes.py - Account API Client → Salesforce: queries accounts
services/salesforce_service.py - Account Action → Audit and Error Logs: logs outcome
routes/action_routes.py