Improve auth process 4

This commit is contained in:
Urtzi Alfaro
2025-07-20 09:18:08 +02:00
parent 0b1e67a76c
commit 608585c72c
6 changed files with 59 additions and 43 deletions

View File

@@ -119,6 +119,37 @@ fi
echo ""
# ================================================================
# STEP 5: TENANT REGISTRATION (OPTIONAL)
# ================================================================
log_step "Step 5: Registering a bakery/tenant"
BAKERY_RESPONSE=$(curl -s -X POST "$API_BASE/api/v1/tenants/bakeries" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d "{
\"name\": \"Test Bakery $(date +%H%M)\",
\"business_type\": \"bakery\",
\"address\": \"Calle Test 123\",
\"city\": \"Madrid\",
\"postal_code\": \"28001\",
\"phone\": \"+34600123456\"
}")
echo "Bakery Registration Response:"
echo "$BAKERY_RESPONSE" | jq '.'
if echo "$BAKERY_RESPONSE" | jq -e '.id' > /dev/null; then
TENANT_ID=$(echo "$BAKERY_RESPONSE" | jq -r '.id')
log_success "Bakery registration successful! Tenant ID: $TENANT_ID"
else
log_warning "Bakery registration endpoint may not be fully implemented"
fi
echo ""
# ================================================================
# STEP 2: USER LOGIN
# ================================================================
@@ -237,36 +268,6 @@ fi
echo ""
# ================================================================
# STEP 5: TENANT REGISTRATION (OPTIONAL)
# ================================================================
log_step "Step 5: Registering a bakery/tenant"
BAKERY_RESPONSE=$(curl -s -X POST "$API_BASE/api/v1/tenants/bakeries" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d "{
\"name\": \"Test Bakery $(date +%H%M)\",
\"business_type\": \"bakery\",
\"address\": \"Calle Test 123\",
\"city\": \"Madrid\",
\"postal_code\": \"28001\",
\"phone\": \"+34600123456\"
}")
echo "Bakery Registration Response:"
echo "$BAKERY_RESPONSE" | jq '.'
if echo "$BAKERY_RESPONSE" | jq -e '.id' > /dev/null; then
TENANT_ID=$(echo "$BAKERY_RESPONSE" | jq -r '.id')
log_success "Bakery registration successful! Tenant ID: $TENANT_ID"
else
log_warning "Bakery registration endpoint may not be fully implemented"
fi
echo ""
# ================================================================
# STEP 6: TOKEN REFRESH
# ================================================================