# Auth API Comparison: Old vs New

Observed: 2026-08-27  
Old FE/BE source: `tiar-charging-app`, `auth-service`, `user-services`  
New API contract source: `local-documents/API - TIAR PUBLIC.postman_collection.json`

## Summary

The new collection uses `/v1/auth/*` and `/v1/user`, while the old customer web uses `/v1.1/*`. The browser routes should remain the old customer routes; the backend path differences belong in the new adapter/service layer.

The old backend base domain `https://api-dev.tiar.ai` is confirmed by the old web fallback configuration, the mobile app's dev configuration, and backend service environment samples. The new backend v1 base domain is `https://dev.api.tiar.ai` (confirmed by the provided deployment information and a live response). The Postman collection leaves its `{{url}}` base variable empty and provides tenant routing information separately.

The same dev test account was accepted by the old `/v1.1/login-password` endpoint with HTTP `200`. A direct request to the new `/v1/auth/login` endpoint at `https://dev.api.tiar.ai` returned `403 tenant domain is not registered` without tenant routing. With `X-Forwarded-Host: parking-plus.dev.tiar.ai` and `X-App-Name: mobile_app`, the request reached the new Auth service and returned `500 user not found`. A registration request using the dummy email and the same routing headers returned HTTP `201` with `ok: true`, including email-verification and user result fields. This confirms the new domain, route, tenant routing, and registration path are reachable; the `.invalid` test email cannot receive the verification link.

## Route mapping and availability

| Capability | Old backend | New collection | Initial classification | Notes |
|---|---|---|---|---|
| Check email | `POST /v1.1/check-email` | `POST /v1/auth/check-email` | Same intent, new path | Live v1 response confirmed for registered and unregistered flow routing. |
| Sign up | `POST /v1.1/sign-up` | `POST /v1/auth/sign-up` | Same intent, new path | Live v1 sends the verification email. |
| Email verification | `POST /v1.1/email-verification/verify` | `GET /v1/auth/sign-up/email-verification` | Backend blocker | Frontend adapter is wired, but the live v1 endpoint returns `401 Access token is required` before checking the challenge token. This endpoint must be public. |
| Request OTP | `POST /v1.1/request-otp` | Not present | API/collection gap | Old sign-in supports OTP. |
| Verify OTP | `POST /v1.1/verify-otp` | Not present | API/collection gap | Old sign-in and password setup depend on OTP. |
| Password login | `POST /v1.1/login-password` | `POST /v1/auth/login` | Same intent, new path | Frontend adapter is wired; successful login is blocked until a v1 registration can complete. |
| Sign-up password setup | `POST /v1.1/signup/set-password` | `POST /v1/auth/sign-up/set-password` | Flow differs | Live v1 requires `token`, password confirmation, first/last name, phone, and date of birth. The local completion form and adapter now provide them. |
| Required password setup | `POST /v1.1/set-password` | Not present | API/collection gap | Needed for `password_setup_required` accounts. |
| Refresh token | `POST /v1.1/refresh-token` | `POST /v1/auth/refresh-token` | Same intent, new path | Token response contract needs validation. |
| Change password | `POST /v1.1/change-password` | `POST /v1/auth/change-password` | Same intent, new path | v1 uses `old_password`, `new_password`, and `confirm_password`; local browser UAT passed after migration. |
| Request password reset | `POST /v1.1/request-password-reset` | `POST /v1/auth/request-password-reset` | Same intent, new path | v1 endpoint verified; reset completion is also available in v1. |
| Reset password | `POST /v1.1/reset-password` | `POST /v1/auth/reset-password` | Same intent, new path | v1 accepts `token`, `new_password`, and `confirm_password`. |
| Current user | `GET /v1.1/users/me` | `GET /v1/user` | Same intent, new path | Authenticated response needs validation. |
| Logout | `POST /v1.1/logout` | Not present | API/collection gap | Old FE revokes refresh token and clears cookies. |
| Token introspection | `POST /v1.1/introspect-token` | Not present | Not required yet | Old backend route exists; new FE may not need it. |

## Collection limitations

- The collection has no saved response examples for the Auth requests.
- The collection has no visible Postman test scripts for these requests.
- The `url` variable is empty and must be configured before importing/running.
- The requests use `X-App-Name: mobile_app` and organization information appears to be inferred from the host header; this must be confirmed for the `SANDBOX` organization. Existing app configuration uses `organization_code: SANDBOX` and `app_name: mobile.SANDBOX` (the old web lowercases the organization suffix), so the v1 header contract may not match the old contract.

## Current conclusion

The scoped register/password-sign-in frontend flow is wired to v1, including verification and account completion. End-to-end registration remains blocked by the live email-verification endpoint requiring an access token. Optional Auth features such as OTP and password recovery remain intentionally deferred.

## Required next checks

1. Make `GET /v1/auth/sign-up/email-verification` public in the dev gateway/backend and confirm that a valid challenge returns `setup_password_token`.
2. Complete set-password with the returned setup token and record the non-secret success schema.
3. Confirm successful password login and authenticated `GET /v1/user` for the completed account.
4. Handle OTP, password recovery, refresh, and logout in a later Auth migration scope.
