# Auth Service

Authentication microservice for the Emmanylcode SMS architecture. The service is a small plain-PHP application with a local kernel, router, DI container, domain services, MySQL repositories, RS256 JWT access tokens, refresh tokens, token revocation, health checks, and JWKS/public-key discovery for other microservices.

Quick start:

1. Install dependencies

```bash
cd /opt/lampp/htdocs/projects/SMS-MICROSERVICES/auth-service
composer install
```

2. Run migration to create database and tables

```bash
composer migrate
# or
php migration.php
```

3. Run the dev server

```bash
php -S localhost:8000 -t public
```

4. Open Swagger UI and load `swagger.yaml` to test endpoints. After login, use `Authorize` with `Bearer <token>`.

Core endpoints:

```text
POST /v1/auth/register
POST /v1/auth/login
POST /v1/auth/refresh
POST /v1/auth/logout
POST /v1/auth/validate-token
GET  /v1/user/me
GET  /.well-known/jwks.json
GET  /public-key
GET  /health
```

Backward-compatible endpoints remain available under `/api/auth/*` for existing tests and clients.

Notes:
- Configure DB access via `.env`.
- Replace `app/Keys/private.pem` and `app/Keys/public.pem` with secure keys for production.



http://localhost/projects/SMS-MICROSERVICES/
http://localhost/projects/SMS-MICROSERVICES/auth-service/public/
http://localhost/projects/SMS-MICROSERVICES/auth-service/swagger.yaml
http://localhost/projects/SMS-MICROSERVICES/auth-service/public/swagger/
