🔐 Test OTP Login

OTP (locale / verifica)

1. Genera OTP

POST /?action=otp_generate
{
  "uid": "test-user-1"
}

2. Verifica OTP Locale

POST /?action=otp_verify_local
{
  "uid": "test-user-1",
  "otp_code": "123456"
}

3. Verifica OTP (con DOI se registrazione)

POST /?action=verify_otp
{
  "email": "user@example.com",
  "otp_code": "123456",
  "is_registration": true,
  "uid": "PNISV3sRwtjyz3d",
  "access_token": "eyJhbGciOi..."
}

User Collector

3b. Login ingestion (User Collector)

Invia a /user-collector/ingest/login solo uid + accessToken (niente Piano access/list).

POST /?action=login-ingestion-user-collector
{
  "uid": "google-oauth2|104497752255509497539",
  "accessToken": "sddadsa"
}

Piano.io

4. Login

POST /?action=login
Passwordless:
{ "email": "user@example.com", "stay_logged_in": false }

Con password:
{ "email": "user@example.com", "password": "secret", "stay_logged_in": false }

5. Registrazione

POST /?action=register
{
  "email": "user@example.com",
  "consents": { "terms_conditions": true },
  "is_magic_link_sent": true
}

6. Aggiorna Profilo

POST /?action=update_profile
Il frontend fa una sola chiamata. Il backend splitta:
1) first_name / last_name / email → form Piano
2) otp_phone / city / birth_date → JSON custom fields
{
  "uid": "PNIkNUVX7tk2nm4",
  "first_name": "Luca",
  "last_name": "Giuliani",
  "birth_date": "1990-01-15",
  "city": "Roma",
  "otp_phone": "331222222"
}

7. DOI Confirm

POST /?action=doi_confirm
{
  "uid": "PNIdym3yvtjbazv"
}

8. Get User

POST /?action=get_user
{ "uid": "PNIxxxx" }

POST /?action=get_user_email
{ "email": "user@example.com" }
Risposta data: uid, email, first_name, last_name, city, birth_date, otp_phone, has_otp_phone, profile_complete

9. Search User (per telefono)

POST /?action=search_user
{
  "phone": "3331234567"
}

10. Access Token

POST /?action=access_token
{
  "uid": "PNIdym3yvtjbazv"
}

Email (diagnostica SMTP)

11. Test invio email

POST /?action=test_mail
{
  "to": "tua@email.com"
}
Risposta: config SMTP + steps (EHLO, AUTH, MAIL FROM, RCPT TO, DATA) con errore esatto se fallisce

12. Test invio SMS

POST /?action=test_sms
{
  "phone": "3331234567"
}
Risposta: esito gateway + debug (receiver normalizzato, http_code, response)

📋 Log Chiamate