Skip to content

Commit 543c921

Browse files
committed
make secrets secret
1 parent 87c8aa4 commit 543c921

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

.env.template

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
SOLESEARCH_DEFAULT_LIMIT=20
44
# The maximum number of sneakers to return in a single request
55
SOLESEARCH_MAX_LIMIT=100
6-
# The default number of sneakers to skip in a single request
7-
SOLESEARCH_DEFAULT_OFFSET=0
86
# ====================
97

108
# === MongoDB ===
@@ -21,5 +19,7 @@ SOLESEARCH_DB_PRIMARY_COLLECTION=sneakers
2119
SOLESEARCH_STOCKX_API_KEY=
2220
SOLESEARCH_STOCKX_CLIENT_ID=
2321
SOLESEARCH_STOCKX_CLIENT_SECRET=
24-
SOLESEARCH_STOCKX_CALLBACK_URL=https://localhost:3000/auth/stockx
22+
SOLESEARCH_STOCKX_CALLBACK_URL=https://localhost:8000/auth/stockx
23+
SOLESEARCH_STOCKX_CALLBACK_STATE=
24+
SOLESEARCH_SESSION_SECRET=
2525
# ===================

src/api/main.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
allow_headers=["*"],
4444
)
4545
# Enable session handling for StocxkX OAuth flow
46-
app.add_middleware(SessionMiddleware, secret_key="vT!y!r5s#bwcDxDG")
46+
SESSION_SECRET = os.environ.get("SOLESEARCH_SESSION_SECRET", "this should be a secret")
47+
app.add_middleware(SessionMiddleware, secret_key=SESSION_SECRET)
4748

4849

4950
@app.on_event("startup")
@@ -64,7 +65,7 @@ async def startup_event():
6465
if __name__ == "__main__":
6566
import uvicorn
6667

67-
# Run the app locally using Uvicorn
68+
# Run the app locally using Uvicorn, with SSL enabled
6869
uvicorn.run(
6970
app,
7071
host="localhost",

src/api/routes/auth.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
STOCKX_CLIENT_ID = os.environ.get("SOLESEARCH_STOCKX_CLIENT_ID", None)
1212
STOCKX_CLIENT_SECRET = os.environ.get("SOLESEARCH_STOCKX_CLIENT_SECRET", None)
1313
STOCKX_API_KEY = os.environ.get("SOLESEARCH_STOCKX_API_KEY", None)
14+
STOCKX_STATE = os.environ.get(
15+
"SOLESEARCH_STOCKX_CALLBACK_STATE", "this should be a secret string"
16+
)
1417

1518
session = requests.session()
1619

@@ -22,7 +25,7 @@
2225

2326
@router.get("/stockx")
2427
async def login_via_stockx(state: str, request: Request):
25-
if state != "YTPc2DqAwnmhHGzSQVtzwEPq2eEgprUi":
28+
if state != STOCKX_STATE:
2629
raise HTTPException(status_code=400, detail="Bad state. Nice try, buster.")
2730
auth_url = "https://accounts.stockx.com/authorize"
2831
print(STOCKX_CLIENT_ID, STOCKX_CLIENT_SECRET, STOCKX_API_KEY)
@@ -42,7 +45,7 @@ async def login_via_stockx(state: str, request: Request):
4245
async def stockx_oauth_callback(state: str, code: str, request: Request):
4346
if code is None:
4447
raise HTTPException(status_code=400, detail="No code returned from StockX.")
45-
if state != "YTPc2DqAwnmhHGzSQVtzwEPq2eEgprUi":
48+
if state != STOCKX_STATE:
4649
raise HTTPException(status_code=400, detail="Bad state. Nice try, buster.")
4750
try:
4851
headers = {

0 commit comments

Comments
 (0)