From b904710cfc0e6b44a6a94a49112a26d0ab498e4c Mon Sep 17 00:00:00 2001 From: Abi Raja Date: Wed, 29 Nov 2023 14:00:45 -0500 Subject: [PATCH] add secret to access the backend --- backend/access_token.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/access_token.py b/backend/access_token.py index 6a9bbd4..bed7273 100644 --- a/backend/access_token.py +++ b/backend/access_token.py @@ -1,11 +1,17 @@ import json +import os import httpx async def validate_access_token(access_code: str): async with httpx.AsyncClient() as client: url = "http://localhost:8000/screenshot_to_code/validate_access_token" - data = json.dumps({"access_code": access_code}) + data = json.dumps( + { + "access_code": access_code, + "secret": os.environ.get("PICO_BACKEND_SECRET"), + } + ) headers = {"Content-Type": "application/json"} response = await client.post(url, content=data, headers=headers)