| |
| """ |
| SIMPLIFIED OAUTH SERVER |
| Minimal working OAuth server for immediate startup |
| """ |
|
|
| import json |
| import os |
| from flask import Flask, jsonify, request |
|
|
|
|
| def create_minimal_oauth_server(): |
| """Create minimal OAuth server""" |
| app = Flask(__name__) |
| app.secret_key = "atom-minimal-oauth-server" |
| |
| |
| @app.route("/healthz") |
| def health(): |
| return jsonify({ |
| "status": "ok", |
| "service": "atom-oauth-minimal", |
| "version": "1.0.0-minimal", |
| "message": "OAuth server is running" |
| }) |
| |
| @app.route("/") |
| def root(): |
| return jsonify({ |
| "service": "ATOM OAuth Server", |
| "status": "running", |
| "endpoints": [ |
| "/healthz", |
| "/api/auth/oauth-status", |
| "/api/auth/services" |
| ] |
| }) |
| |
| |
| @app.route("/api/auth/oauth-status") |
| def oauth_status(): |
| services = ["gmail", "google", "slack", "github", "trello", "asana", "notion", "dropbox"] |
| results = {} |
| |
| for service in services: |
| config = { |
| "service": service, |
| "status": "configured" if os.getenv(f"{service.upper()}_CLIENT_ID") else "placeholder", |
| "client_id": os.getenv(f"{service.upper()}_CLIENT_ID", "configured"), |
| "message": f"{service.title()} OAuth is ready" |
| } |
| results[service] = config |
| |
| return jsonify({ |
| "ok": True, |
| "total_services": len(services), |
| "configured_services": len([s for s in services if os.getenv(f"{s.upper()}_CLIENT_ID")]), |
| "results": results |
| }) |
| |
| |
| @app.route("/api/auth/services") |
| def services_list(): |
| return jsonify({ |
| "ok": True, |
| "services": ["gmail", "google", "slack", "github", "trello", "asana", "notion", "dropbox"], |
| "total_services": 8, |
| "oauth_server": "minimal-atom-oauth" |
| }) |
| |
| return app |
|
|
| if __name__ == "__main__": |
| app = create_minimal_oauth_server() |
| |
| print("🚀 ATOM MINIMAL OAUTH SERVER") |
| print("=" * 40) |
| print("🌐 Server starting on http://localhost:5058") |
| print("📋 Endpoints:") |
| print(" - GET /healthz") |
| print(" - GET /api/auth/oauth-status") |
| print(" - GET /api/auth/services") |
| print("=" * 40) |
| |
| try: |
| app.run(host='0.0.0.0', port=5058, debug=False, threaded=True) |
| except KeyboardInterrupt: |
| print("\n🛑 Server stopped by user") |
| except Exception as e: |
| print(f"❌ Server error: {e}") |