Login POST
Autenticati con email e password per ottenere un token JWT.
Endpoint
POST https://api.pocketalert.app/v1/auth/signinRichiesta
Header
| Header | Obbligatorio | Descrizione |
|---|---|---|
Content-Type | ✅ | application/json |
Parametri del body
| Parametro | Tipo | Obbligatorio | Descrizione |
|---|---|---|---|
email | string | ✅ | Il tuo indirizzo email registrato |
password | string | ✅ | La password del tuo account |
Esempio di richiesta
bash
curl -X POST "https://api.pocketalert.app/v1/auth/signin" \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "your-password"
}'javascript
const response = await fetch('https://api.pocketalert.app/v1/auth/signin', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
email: '[email protected]',
password: 'your-password'
})
});
const { token } = await response.json();
// Use token in Authorization header for subsequent requestspython
import requests
response = requests.post(
'https://api.pocketalert.app/v1/auth/signin',
json={
'email': '[email protected]',
'password': 'your-password'
}
)
data = response.json()
# Use token in Authorization header for subsequent requestsphp
$response = Http::post('https://api.pocketalert.app/v1/auth/signin', [
'email' => '[email protected]',
'password' => 'your-password',
]);
$token = $response->json()['token'];
// Use token in Authorization header for subsequent requestsRisposta
Risposta di successo
200 OK
Autenticazione riuscita
| Campo | Tipo | Descrizione |
|---|---|---|
token | string | Token JWT per l'autenticazione API |
email | string | Indirizzo email dell'utente |
name | string | Nome visualizzato dell'utente |
avatar | string | URL dell'immagine avatar dell'utente |
json
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"email": "[email protected]",
"name": "John Doe",
"avatar": ""
}Uso del token
Dopo aver ottenuto il token, includilo nelle richieste successive:
bash
curl -X GET "https://api.pocketalert.app/v1/messages" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."Risposte di errore
| Stato | Descrizione |
|---|---|
400 | Richiesta non valida — email o password mancanti, o captcha non superato |
401 | Credenziali non valide — password errata o email sconosciuta |
Consiglio
Per le integrazioni lato server, ti consigliamo di usare le chiavi API al posto dei token JWT. Le chiavi API non scadono e sono più semplici da gestire.