Login
Generazione Token
Chiamata per effettuare il login:
POST/api/login_check
Body
{
"username": "user",
"password": "pass"
}
Body Response
{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9",
"refresh_token": "2554c75231b88cc7e269ef3e7755bdc9",
"refresh_token_url": "http://localhost/api/token/refresh?refresh_token=2554c75231b88cc7e269ef3e7755bdc9",
"refresh_token_expiration": 1681780611
}
token: Token JWT con informazioni sull'utente e ruoli attivirefresh_token: Stringa da usare nella chiamata di refresh per refreshare il Token Attivo. In questo modo non è richiesto ulteriore login.refresh_token_url: Url di chiamata refresh token già pronta all'uso.refresh_token_expiration: Data e ora di scadenza del refresh_token.
Utilizzo del JWT Token
L'utilizzo standard è tramite il classico header di autenticazione Bearer:
Authorization: Bearer [token]
Refresh Token
Chiamata per effettuare il refresh del token:
POST/api/token/refresh
Query Params
| Nome | Tipo | Obbligatorio | Descrizione |
|---|---|---|---|
| refresh_token | string | Si | Il refresh token ottenuto dalla chiamata di login |
Body Response
{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpYXQiOjE2ODE3NTIyNzgsImV4cCI6MTY4MTc4MTA3OCwicm9sZXMiOlsiUk9MRV9QSU1DT1JFX1VTRVIiXSwidXNlcm5hbWUiOiJtYXJjbyIsInRva2VuX3R5cGUiOiJiZWFyZXIiLCJzY29wZSI6ImN1c3RvbSIsImNoYW5nZV9wYXNzd29yZCI6ZmFsc2UsInVzZXJfaWQiOjMsImlwIjoiMTkyLjE2OC4xNzYuMSIsImxvY2FsZSI6ImVuIn0.Qv6_7Pa4TMhjvuLYlKs-oow9D4JOqQ6iBiyJahyOuqrsjYiXNq1QNihI2MOVyajWrb1cRZJp5BRIe2zDQmnKx5g2UaKcMX2-uj7OjPi9fE_YzQP1QZY5Z0DM5L0kTAvuidguuhNNWli30MKnzoj1zxwFJYBQYaeKmO9sRNBqoLwKpO9rRY-OkyFjsXFwlbYJy3Sx-sp9B8eDrBx6CeBlj4payZnEeVuzyxXSeU6UJ3mIa7QdyTrHoNwJ8iLLzg4-yDXBgIgclTzh07IUhUdOoTxuQhkhqDyzk5VTkw3HNdQDOWGK1k8B0JbfI3RZSD2h73NL7veYN99hDBamjlEwEg",
"refresh_token": "2554c75231b88cc7e269ef3e7755bdc903931999c11e3d8a24a7de85aaefce0077dae1113112de59e6b446ca148cc211605a7df101ba1aca7568d9ec046b3301",
"refresh_token_url": "http://localhost/api/token/token/refresh?refresh_token=2554c75231b88cc7e269ef3e7755bdc903931999c11e3d8a24a7de85aaefce0077dae1113112de59e6b446ca148cc211605a7df101ba1aca7568d9ec046b3301",
"refresh_token_expiration": 1681781078
}
La risposta è simile a quella del login. E' presente un nuovo token generato a partire dal refresh_token che viene riportato aggiornato della sua data di scadenza: