Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/akibanks/tienda_musica_web/llms.txt

Use this file to discover all available pages before exploring further.

VinylVibes uses JWT-based authentication. Two endpoints handle auth: POST /login returns a token and session metadata, and POST /registro creates a new account. The JWT must be included in all protected requests via the Authorization: Bearer header. Tokens are stored in localStorage by the frontend after a successful login and cleared on logout.

POST /login

Authenticates an existing user and returns a signed JWT alongside session metadata. The frontend stores the token and user state in localStorage immediately after a successful response.

Request body

nombre_usuario
string
required
The account username.
password
string
required
The account password.

Example request

curl -X POST https://api-tienda-vinilos.onrender.com/login \
  -H 'Content-Type: application/json' \
  -d '{"nombre_usuario": "admin_chocolate", "password": "chocolate"}'

Response fields

token
string
Signed JWT to include in subsequent authenticated requests via Authorization: Bearer <token>.
nombre
string
The user’s display name as stored in the database.
es_admin
boolean
true if the user holds the admin role.
es_demo
boolean
true if the user holds the demo (read-only admin) role.

Success response (200)

{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "nombre": "admin_chocolate",
  "es_admin": false,
  "es_demo": true
}

Error response (401)

{ "error": "Credenciales inválidas" }

localStorage keys written after login

After a successful /login response, login.js writes the following keys to localStorage:
KeyValue
vv_tokentoken from the response
usuarioLogueadonombre from the response
esAdmin"true" if es_admin is true, otherwise "false"
esDemo"true" if es_demo is true, otherwise "false"

POST /registro

Creates a new user account. The frontend validates that the password is at least 6 characters before sending the request.

Request body

nombre_usuario
string
required
The desired username for the new account.
password
string
required
The account password. Must be at least 6 characters long.

Example request

curl -X POST https://api-tienda-vinilos.onrender.com/registro \
  -H 'Content-Type: application/json' \
  -d '{"nombre_usuario": "nuevo_usuario", "password": "mi_clave_123"}'

Success response (200)

{ "message": "Cuenta creada exitosamente" }

Error response (400)

{ "error": "El usuario ya existe" }
New accounts are created with the cliente role by default. An admin must manually elevate the role via the admin panel.

Build docs developers (and LLMs) love