add secret to access the backend
This commit is contained in:
parent
7889e0c3d5
commit
b904710cfc
@ -1,11 +1,17 @@
|
|||||||
import json
|
import json
|
||||||
|
import os
|
||||||
import httpx
|
import httpx
|
||||||
|
|
||||||
|
|
||||||
async def validate_access_token(access_code: str):
|
async def validate_access_token(access_code: str):
|
||||||
async with httpx.AsyncClient() as client:
|
async with httpx.AsyncClient() as client:
|
||||||
url = "http://localhost:8000/screenshot_to_code/validate_access_token"
|
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"}
|
headers = {"Content-Type": "application/json"}
|
||||||
|
|
||||||
response = await client.post(url, content=data, headers=headers)
|
response = await client.post(url, content=data, headers=headers)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user