File size: 1,513 Bytes
73c7f92
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Opción A — si ENVIRONMENT=development en HF

  export M6_URL="https://modulo-6-api.hf.space/api/v1"

  TOKEN=$(curl -s "$M6_URL/auth/token?usuario=ADMINISTRATIVO&password=x" \
    | python3 -c "import sys,json; print(json.load(sys.stdin)['access_token'])")

  curl -s "$M6_URL/_debug/settings" -H "Authorization: Bearer $TOKEN"

  Si te devuelve 404 en el primer curl, es que el Space está en production y el endpoint de dev
  token está deshabilitado a propósito → usá la opción B.

  Opción B — vía SSO real contra el Core (M10)

  export M6_URL="https://modulo-6-api.hf.space/api/v1"
  export CORE_URL="https://api.healthcare.cantero.ar"

  # 1. Login real en el Core con un usuario ADMINISTRATIVO
  CORE_TOKEN=$(curl -s -X POST "$CORE_URL/auth/login" \
    -H "Content-Type: application/json" \
    -d '{"email": "TU_EMAIL", "password": "TU_PASSWORD"}' \
    | python3 -c "import sys,json; print(json.load(sys.stdin)['token'])")

  # 2. Pedirle un ticket SSO al Core
  TICKET=$(curl -s -X POST "$CORE_URL/auth/sso-ticket" \
    -H "Authorization: Bearer $CORE_TOKEN" \
    | python3 -c "import sys,json; print(json.load(sys.stdin)['ticket'])")

  # 3. Canjearlo contra M6
  M6_TOKEN=$(curl -s -X POST "$M6_URL/auth/sso-exchange" \
    -H "Content-Type: application/json" \
    -d '{"ticket": "'"$TICKET"'"}' \
    | python3 -c "import sys,json; print(json.load(sys.stdin)['token'])")

  # 4. Pegarle al endpoint de debug
  curl -s "$M6_URL/_debug/settings" -H "Authorization: Bearer $M6_TOKEN"