Fix: Better error handling for missing Google OAuth credentials
- Add .env.example with required environment variables - Add helpful warning message when google_client_id/secret are missing - Update steps_to_run.md with detailed setup instructions - Include instructions for creating Google OAuth credentials Addresses #9
This commit is contained in:
12
server/.env.example
Normal file
12
server/.env.example
Normal file
@@ -0,0 +1,12 @@
|
||||
# Flask Configuration
|
||||
FLASK_ENV=dev
|
||||
FLASK_APP=webserver.py
|
||||
SECRET_KEY=your-secret-key-here
|
||||
|
||||
# Google OAuth Credentials (for user authentication)
|
||||
# Get these from https://console.cloud.google.com/apis/credentials
|
||||
google_client_id=your-google-client-id
|
||||
google_client_secret=your-google-client-secret
|
||||
|
||||
# OpenAI API Key (users can also add this in the UI)
|
||||
# OPENAI_API_KEY=sk-your-openai-api-key
|
||||
@@ -25,8 +25,19 @@ scope = [
|
||||
"https://www.googleapis.com/auth/userinfo.profile",
|
||||
"openid"
|
||||
]
|
||||
google_client_id = os.environ['google_client_id']
|
||||
google_client_secret = os.environ['google_client_secret']
|
||||
google_client_id = os.environ.get('google_client_id')
|
||||
google_client_secret = os.environ.get('google_client_secret')
|
||||
|
||||
if not google_client_id or not google_client_secret:
|
||||
print("=" * 60)
|
||||
print("WARNING: Google OAuth credentials not found!")
|
||||
print("Please set the following environment variables:")
|
||||
print(" - google_client_id")
|
||||
print(" - google_client_secret")
|
||||
print("")
|
||||
print("Get these from: https://console.cloud.google.com/apis/credentials")
|
||||
print("See server/.env.example for reference.")
|
||||
print("=" * 60)
|
||||
word_limit = 50 # word limit for task brainstorming
|
||||
|
||||
rp = Blueprint('rp', __name__)
|
||||
|
||||
@@ -2,17 +2,36 @@
|
||||
|
||||
1. To run server, install virtualenv first https://virtualenv.pypa.io/en/latest/ and create a new virtual environment to load all necessary python packages
|
||||
|
||||
2. Go to server folder and install all necessary packages using command "pip install -r requirements.txt"
|
||||
2. Go to server folder and install all necessary packages using command `pip install -r requirements.txt`
|
||||
|
||||
3. Set environment variables FLASK_ENV=dev and FLASK_APP=webserver.py
|
||||
3. Set up environment variables:
|
||||
- Copy `.env.example` to `.env`: `cp .env.example .env`
|
||||
- Edit `.env` and add your credentials:
|
||||
- `FLASK_ENV=dev`
|
||||
- `FLASK_APP=webserver.py`
|
||||
- `google_client_id` - Get from [Google Cloud Console](https://console.cloud.google.com/apis/credentials)
|
||||
- `google_client_secret` - Get from Google Cloud Console
|
||||
|
||||
4. Create a db for storing all the info using commands i) flask db init ii) flask db migrate iii) flask db upgrade
|
||||
**To create Google OAuth credentials:**
|
||||
1. Go to Google Cloud Console > APIs & Services > Credentials
|
||||
2. Click "Create Credentials" > "OAuth client ID"
|
||||
3. Select "Web application"
|
||||
4. Add authorized redirect URIs:
|
||||
- `http://localhost:5000/rp/google_callback` (for development)
|
||||
5. Copy the Client ID and Client Secret to your `.env` file
|
||||
|
||||
5. Run the server using python webserver.py
|
||||
4. Create a db for storing all the info using commands:
|
||||
```bash
|
||||
flask db init
|
||||
flask db migrate
|
||||
flask db upgrade
|
||||
```
|
||||
|
||||
5. Run the server using `python webserver.py`
|
||||
|
||||
|
||||
# Client
|
||||
|
||||
1. To run client, go to client folder and do npm install
|
||||
1. To run client, go to client folder and do `npm install`
|
||||
|
||||
2. Now run "npm start" and this should start the client
|
||||
2. Now run `npm start` and this should start the client
|
||||
|
||||
Reference in New Issue
Block a user