Skip to content

Commit 4629679

Browse files
Fix karissa (#81)
* switched to server-side sessions (Flask-Session + filesystem)
1 parent 162fb82 commit 4629679

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

server/app/__init__.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,31 @@
11
from flask import Flask
22
from flask_cors import CORS
33
from dotenv import load_dotenv
4+
from flask_session import Session
45

56
from app.api import clickwrap, requests, common, auth
67

7-
88
load_dotenv()
99

1010
URL_PREFIX = '/api'
1111

1212
app = Flask(__name__)
1313
app.config.from_pyfile("config.py")
14+
15+
# Add server-side session config
16+
app.config.update(
17+
SESSION_TYPE="filesystem",
18+
SESSION_FILE_DIR="/tmp/flask_session",
19+
SESSION_PERMANENT=False,
20+
SESSION_USE_SIGNER=True,
21+
SESSION_COOKIE_NAME="sid"
22+
)
23+
24+
Session(app)
25+
1426
app.register_blueprint(clickwrap, url_prefix=URL_PREFIX)
1527
app.register_blueprint(common, url_prefix=URL_PREFIX)
1628
app.register_blueprint(requests, url_prefix=URL_PREFIX)
1729
app.register_blueprint(auth, url_prefix=URL_PREFIX)
18-
cors = CORS(app)
30+
31+
cors = CORS(app)

server/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ six==1.16.0
1919
urllib3==2.2.3
2020
Werkzeug==3.1.3
2121
requests==2.*
22+
Flask-Session>=0.5.0

0 commit comments

Comments
 (0)