mirror of
https://github.com/kevin-DL/full-stack-fastapi-postgresql.git
synced 2026-01-11 18:04:28 +00:00
14 lines
392 B
Python
14 lines
392 B
Python
import requests
|
|
|
|
from app.core import config
|
|
|
|
|
|
def user_authentication_headers(server_api, email, password):
|
|
data = {"username": email, "password": password}
|
|
|
|
r = requests.post(f"{server_api}{config.API_V1_STR}/login/access-token", data=data)
|
|
response = r.json()
|
|
auth_token = response["access_token"]
|
|
headers = {"Authorization": f"Bearer {auth_token}"}
|
|
return headers
|