curl -X POST 'https://api.weir.ai/auth/login' \
-H 'Content-Type: application/json' \
-d '{
"username": "[email protected]",
"password": "SecureAdminPass123!"
}'
{
"data": {
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refreshToken": "admin_refresh_123456789",
"expiresIn": 3600,
"user": {
"id": "admin_123456789",
"fullname": "Admin User",
"email": "[email protected]",
"role": "Super_Admin"
}
},
"message": "Login successful",
"status": "success"
}
Admin user login with username and password
curl -X POST 'https://api.weir.ai/auth/login' \
-H 'Content-Type: application/json' \
-d '{
"username": "[email protected]",
"password": "SecureAdminPass123!"
}'
{
"data": {
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refreshToken": "admin_refresh_123456789",
"expiresIn": 3600,
"user": {
"id": "admin_123456789",
"fullname": "Admin User",
"email": "[email protected]",
"role": "Super_Admin"
}
},
"message": "Login successful",
"status": "success"
}
curl -X POST 'https://api.weir.ai/auth/login' \
-H 'Content-Type: application/json' \
-d '{
"username": "[email protected]",
"password": "SecureAdminPass123!"
}'
{
"data": {
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refreshToken": "admin_refresh_123456789",
"expiresIn": 3600,
"user": {
"id": "admin_123456789",
"fullname": "Admin User",
"email": "[email protected]",
"role": "Super_Admin"
}
},
"message": "Login successful",
"status": "success"
}
const adminLogin = async (username, password) => {
const response = await fetch('https://api.weir.ai/auth/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username, password })
});
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
return await response.json();
};
Was this page helpful?