Fix jwt-token

This commit is contained in:
2025-09-07 11:20:37 +02:00
parent 5f8938d5bb
commit 2e17e4d1d4
4 changed files with 12 additions and 8 deletions

View File

@@ -4,10 +4,11 @@
# API Base URL - Tests default to localhost:3002 for local development # API Base URL - Tests default to localhost:3002 for local development
API_BASE_URL=http://localhost:3002/api API_BASE_URL=http://localhost:3002/api
# For production/remote testing, update to your deployment: # For production/remote testing with base path, update to your deployment:
# API_BASE_URL=https://your-domain.com/uggla/api # API_BASE_URL=https://your-domain.com/uggla/api
# Base path (should match VITE_BASE_PATH) # Base path (should match VITE_BASE_PATH) - used to construct full API URL
VITE_BASE_PATH=/uggla
VITE_BASE_PATH=/uggla VITE_BASE_PATH=/uggla
# Authentication configuration # Authentication configuration

View File

@@ -56,16 +56,17 @@ def authenticate():
try: try:
print(f"🔐 Authenticating as user: {USERNAME}") print(f"🔐 Authenticating as user: {USERNAME}")
response = requests.post(f"{API_BASE_URL}/auth/login", json=login_data, verify=False) response = requests.post(f"{API_BASE_URL}/users/login", json=login_data, verify=False)
if response.status_code == 200: if response.status_code == 200:
data = response.json() data = response.json()
AUTH_TOKEN = data.get('token') AUTH_TOKEN = data.get('data', {}).get('token')
if AUTH_TOKEN: if AUTH_TOKEN:
print("✅ Authentication successful") print("✅ Authentication successful")
return True return True
else: else:
print("❌ No token received in response") print("❌ No token received in response")
print(f"Response data: {data}")
return False return False
else: else:
print(f"❌ Authentication failed: {response.status_code}") print(f"❌ Authentication failed: {response.status_code}")

View File

@@ -54,16 +54,17 @@ def authenticate():
try: try:
print(f"🔐 Authenticating as user: {USERNAME}") print(f"🔐 Authenticating as user: {USERNAME}")
response = requests.post(f"{API_BASE_URL}/auth/login", json=login_data, verify=False) response = requests.post(f"{API_BASE_URL}/users/login", json=login_data, verify=False)
if response.status_code == 200: if response.status_code == 200:
data = response.json() data = response.json()
AUTH_TOKEN = data.get('token') AUTH_TOKEN = data.get('data', {}).get('token')
if AUTH_TOKEN: if AUTH_TOKEN:
print("✅ Authentication successful") print("✅ Authentication successful")
return True return True
else: else:
print("❌ No token received in response") print("❌ No token received in response")
print(f"Response data: {data}")
return False return False
else: else:
print(f"❌ Authentication failed: {response.status_code}") print(f"❌ Authentication failed: {response.status_code}")

View File

@@ -48,16 +48,17 @@ def authenticate():
try: try:
print(f"🔐 Authenticating as user: {USERNAME}") print(f"🔐 Authenticating as user: {USERNAME}")
response = requests.post(f"{API_BASE_URL}/auth/login", json=login_data, verify=False) response = requests.post(f"{API_BASE_URL}/users/login", json=login_data, verify=False)
if response.status_code == 200: if response.status_code == 200:
data = response.json() data = response.json()
AUTH_TOKEN = data.get('token') AUTH_TOKEN = data.get('data', {}).get('token')
if AUTH_TOKEN: if AUTH_TOKEN:
print("✅ Authentication successful") print("✅ Authentication successful")
return True return True
else: else:
print("❌ No token received in response") print("❌ No token received in response")
print(f"Response data: {data}")
return False return False
else: else:
print(f"❌ Authentication failed: {response.status_code}") print(f"❌ Authentication failed: {response.status_code}")