{"id":19296845,"url":"https://github.com/zahoorahmad/oauth-flask","last_synced_at":"2026-05-03T11:33:35.439Z","repository":{"id":261997044,"uuid":"885930968","full_name":"ZahoorAhmad/oauth-flask","owner":"ZahoorAhmad","description":"SSO and OAuth Flow Integration for Google, Microsoft, and Other Providers","archived":false,"fork":false,"pushed_at":"2024-11-15T21:00:15.000Z","size":48,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-24T00:44:09.269Z","etag":null,"topics":["authentication","authentication-backend","docker","flask","google","microsoft","oauth2","sso"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ZahoorAhmad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-09T19:10:24.000Z","updated_at":"2024-11-15T21:00:19.000Z","dependencies_parsed_at":"2024-11-09T20:21:49.938Z","dependency_job_id":"b91f5089-1745-48b8-af35-64ea44abddd6","html_url":"https://github.com/ZahoorAhmad/oauth-flask","commit_stats":{"total_commits":21,"total_committers":1,"mean_commits":21.0,"dds":0.0,"last_synced_commit":"03c9f1ee79694439b76ff3c4b40849c95b3c54a0"},"previous_names":["zahoorahmad/oauth-flask"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZahoorAhmad%2Foauth-flask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZahoorAhmad%2Foauth-flask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZahoorAhmad%2Foauth-flask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZahoorAhmad%2Foauth-flask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZahoorAhmad","download_url":"https://codeload.github.com/ZahoorAhmad/oauth-flask/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240400292,"owners_count":19795331,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","authentication-backend","docker","flask","google","microsoft","oauth2","sso"],"created_at":"2024-11-09T23:00:40.583Z","updated_at":"2026-05-03T11:33:35.393Z","avatar_url":"https://github.com/ZahoorAhmad.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OAuth Integration with Flask\n\nThis repository provides a simple OAuth integration for various providers like **Google**, **GitHub**, **Microsoft**, **IBM**, **WC** and more using the **Flask** framework. The application allows users to authenticate via these providers and manage OAuth tokens efficiently.\n\nThe project also includes a Dockerized setup using **Docker Compose** with **Redis** for session management.\n\n## Features\n\n- OAuth authentication with multiple providers (Google, GitHub, Microsoft, etc.)\n- Secure token management using OAuth 2.0\n- User information retrieval after successful authentication\n- Docker Compose setup for easy deployment and management\n\n## Prerequisites\n\nBefore you begin, make sure you have the following installed:\n\n- **Docker** and **Docker Compose** for containerization\n- Python 3.11 or higher (if running locally without Docker)\n\n## Getting Started\n\n### 1. Clone the repository\n\nbash\ngit clone https://github.com/ZahoorAhmad/oauth-flask.git\ncd oauth-flask\n\n\n### 2. Setup environment variables\n\nCreate a .env file in the root of the project directory and add the following environment variables. These will be used by the Flask app for OAuth integration:\n\nGOOGLE_CLIENT_ID=your_google_client_id\nGOOGLE_CLIENT_SECRET=your_google_client_secret\nGOOGLE_REDIRECT_URI=http://localhost:5000/callback/google\nGOOGLE_DISCOVERY_URL=https://accounts.google.com/.well-known/openid-configuration\n\nWC_CLIENT_ID=your_wc_client_id\nWC_CLIENT_SECRET=your_wc_client_secret\nWC_REDIRECT_URI=http://localhost:5000/callback/wc\nWC_DISCOVERY_URL=https://accounts.wanclouds.net/.well-known/openid-configuration\n\n\nGITHUB_CLIENT_ID=your_github_client_id\nGITHUB_CLIENT_SECRET=your_github_client_secret\nGITHUB_REDIRECT_URI=http://localhost:5000/callback/github\nGITHUB_DISCOVERY_URL=https://login.microsoftonline.com/common/.well-known/openid-configuration\n\n\nMICROSOFT_CLIENT_ID=your_microsoft_client_id\nMICROSOFT_CLIENT_SECRET=your_microsoft_client_secret\nMICROSOFT_REDIRECT_URI=http://localhost:5000/callback/microsoft\nMICROSOFT_DISCOVERY_URL=https://login.microsoftonline.com/common/.well-known/openid-configuration\n\nIBM_CLIENT_ID=your_ibm_client_id\nIBM_CLIENT_SECRET=your_ibm_client_secret\nIBM_REDIRECT_URI=http://localhost:5000/callback/ibm\nIBM_DISCOVERY_URL=https://iam.cloud.ibm.com/identity/.well-known/openid-configuration\n\nSECRET_KEY=your_flask_secret_key\n\n***NOTE*** = You can set all or any of the env at a time, depending on your requirements and you can skip SECRET_KEY if you don't want but recommended for security concern\n\n### 3. Install dependencies\n\npip install -r requirements.txt\n\n\n### 4. Running the application\n\ndocker-compose build -d --force-recreate\n\n\n### Bonus: Running locally without Docker:\n\nIf you prefer to run the app directly on your local machine without Docker, simply run:\n\npython app/app.py\n\n\n\nThis will start the Flask application on http://localhost:5000.\nAPI Endpoints\n1. Login via OAuth provider\n\nRedirects to the OAuth provider's login page:\n\n    Google: /login/google\n    GitHub: /login/github\n    Microsoft: /login/microsoft\n    IBM: /login/ibm\n    WC: /login/wc\n    ............\n    ............\n    ............\n    ABC: /login/abc\n\nExample:\n\nhttp://localhost:5000/login/google\n\nAfter the user authenticates, they will be redirected to the callback URL you defined in the .env file.\n2. OAuth Callback\n\nHandles the callback from the OAuth provider, and exchanges the authorization code for an access token:\n\n    Google: /callback/google\n    GitHub: /callback/github\n    Microsoft: /callback/microsoft\n    IBM: /callback/ibm\n    WC: /callback/wc\n    ............\n    ............\n    ............\n    ABC: /callback/abc\n\nExample:\n\nhttp://localhost:5000/callback/google?code=authorization_code\n\n3. Get User Information\n\nFetches user information from the provider after authentication:\n\n    Google: /user/google\n    GitHub: /user/github\n    Microsoft: /user/microsoft\n    IBM: /user/ibm\n    WC: /user/wc\n    ............\n    ............\n    ............\n    ABC: /user/abc\n\n\nExample:\n\nhttp://localhost:5000/user/google?access_token=your_access_token\n\nDocker Setup\n\nThis project includes a Docker Compose configuration to run the Flask app and Redis. Follow these steps to set up the Docker containers:\n\n    Build Docker images:\n\ndocker-compose build\n\nStart the containers:\n\n    docker-compose up\n\n    This will start both the Flask application and Redis. The Flask app will be available at http://localhost:5000.\n\nOAuth Providers\n\nThe project supports the following OAuth providers:\n\n    Google\n    GitHub\n    Microsoft\n    IBM\n    WC\n\nTo add more providers, simply:\n\n    Update the OAUTH_PROVIDERS dictionary in app/oauth.py with the provider's details.\n    Add any provider-specific logic for token retrieval and user info if needed.\n\nSession Management\n\nSessions are managed using Redis. When a user logs in via any OAuth provider, their session information is stored in Redis. This enables scalable, secure session management.\nRedis Configuration\n\nThe application uses Redis to store session data. The default configuration assumes Redis is running locally on the default port 6379. This can be modified by changing the Redis URL in the .env file.\nTroubleshooting\n\n    If the application is not redirecting to the OAuth provider's login page, ensure that the redirect_uri in the .env file matches the callback URL defined in your OAuth provider's settings.\n    If you encounter errors related to Redis, ensure that Redis is up and running, and the app can connect to it.\n    Double-check your OAuth provider credentials (client ID, client secret, etc.) to ensure they're correct.\n\nContributing\n\nIf you'd like to contribute to this project, feel free to submit pull requests. Please make sure to:\n\n    Follow Python and Flask best practices.\n    Add tests for new features or bug fixes.\n    Provide clear commit messages.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzahoorahmad%2Foauth-flask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzahoorahmad%2Foauth-flask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzahoorahmad%2Foauth-flask/lists"}