Fix jwt-token
This commit is contained in:
@@ -54,7 +54,14 @@ def authenticate():
|
||||
|
||||
try:
|
||||
print(f"🔐 Authenticating as user: {USERNAME}")
|
||||
response = requests.post(f"{API_BASE_URL}/users/login", json=login_data, verify=False)
|
||||
|
||||
# Add tenant header for localhost requests
|
||||
headers = {"Content-Type": "application/json"}
|
||||
if "localhost" in API_BASE_URL:
|
||||
headers["x-tenant-id"] = "uamils-ab"
|
||||
print(f"🏢 Using tenant: uamils-ab")
|
||||
|
||||
response = requests.post(f"{API_BASE_URL}/users/login", json=login_data, headers=headers, verify=False)
|
||||
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
@@ -76,15 +83,19 @@ def authenticate():
|
||||
|
||||
def get_auth_headers():
|
||||
"""Get headers with authentication token"""
|
||||
headers = {"Content-Type": "application/json"}
|
||||
|
||||
# Add tenant header for localhost requests
|
||||
if "localhost" in API_BASE_URL:
|
||||
headers["x-tenant-id"] = "uamils-ab"
|
||||
|
||||
if SKIP_AUTH:
|
||||
return {"Content-Type": "application/json"}
|
||||
return headers
|
||||
|
||||
if AUTH_TOKEN:
|
||||
return {
|
||||
"Authorization": f"Bearer {AUTH_TOKEN}",
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
return {"Content-Type": "application/json"}
|
||||
headers["Authorization"] = f"Bearer {AUTH_TOKEN}"
|
||||
|
||||
return headers
|
||||
|
||||
def get_next_device_id():
|
||||
"""Get the next available device ID"""
|
||||
|
||||
@@ -3,9 +3,9 @@ const { DataTypes } = require('sequelize');
|
||||
module.exports = (sequelize) => {
|
||||
const Device = sequelize.define('Device', {
|
||||
id: {
|
||||
type: DataTypes.INTEGER,
|
||||
type: DataTypes.UUID,
|
||||
defaultValue: sequelize.Sequelize.UUIDV4,
|
||||
primaryKey: true,
|
||||
autoIncrement: true,
|
||||
allowNull: false,
|
||||
comment: 'Unique device identifier'
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user