Spaces:
Sleeping
Sleeping
ZakharZokhar
commited on
Commit
•
f1cc52c
1
Parent(s):
6f4e5b6
Update main.py
Browse files
main.py
CHANGED
@@ -31,15 +31,11 @@ def echo_text(json_request: Dict[str, Any]):
|
|
31 |
logger.info(json_request)
|
32 |
return {"id": 12}
|
33 |
|
34 |
-
def get_access_token(authorization: str = Header(...)):
|
35 |
-
if authorization.startswith("Bearer "):
|
36 |
-
return authorization.split(" ")[1]
|
37 |
-
raise HTTPException(status_code=401, detail="Unauthorized")
|
38 |
-
|
39 |
@app.post("/auth")
|
40 |
-
def echo_text(
|
41 |
-
if access_token == 'your-random-generated-salt':
|
42 |
return {"session_token": 12}
|
43 |
|
44 |
-
|
|
|
45 |
|
|
|
31 |
logger.info(json_request)
|
32 |
return {"id": 12}
|
33 |
|
|
|
|
|
|
|
|
|
|
|
34 |
@app.post("/auth")
|
35 |
+
def echo_text(json_request: Dict[str, Any]):
|
36 |
+
if (json_request['access_token'] == 'your-random-generated-salt'):
|
37 |
return {"session_token": 12}
|
38 |
|
39 |
+
|
40 |
+
return {"message": "unathorized"}
|
41 |
|