Skip to main content

Overview

The Viax API uses session-based authentication. After successful login, the API returns user information that should be stored and included in subsequent requests where required.
Currently, the API does not use JWT tokens or API keys. Authentication is managed through session data on the client side. Future versions may implement token-based authentication.

Authentication Flow

1

Register or Login

Create an account using /auth/register.php or login with /auth/login.php
2

Store User Data

Save the returned user object, including the id and uuid fields
3

Include User ID

Send the userId or conductor_id in requests that require authentication

Login Request

To authenticate a user:

Login Response

Successful authentication returns:

User Types

The API supports different user types specified in the tipo_usuario field:
string
User role in the systemPossible values:
  • pasajero - Regular passenger user
  • conductor - Driver user
  • admin - Administrative user
  • empresa - Company/fleet user

Authenticated Requests

Include the user ID in requests that require authentication:

As Query Parameter

In Request Body

Checking Authentication Status

Verify if a user account exists:
Response:

Session Management

The client application is responsible for managing user sessions. Store user data securely using:
  • Secure local storage
  • Encrypted shared preferences (mobile)
  • HTTP-only cookies (web)

Session Data Structure

Store the following data from the login response:

Logout

Currently, logout is handled client-side by clearing stored session data. No server-side logout endpoint is required.
To logout:
  1. Clear stored user data from local storage
  2. Clear any cached information
  3. Redirect to login screen

Password Requirements

Implement strong password requirements in your client application:
  • Minimum 8 characters
  • Mix of uppercase and lowercase
  • Include numbers
  • Include special characters

Security Best Practices

Use HTTPS

Always use HTTPS in production to encrypt data in transit

Store Securely

Never store passwords. Only store user IDs and non-sensitive data

Validate Input

Validate all user input before sending to API

Handle Errors

Properly handle authentication errors and timeouts

Common Authentication Errors

See Error Handling for more details.