Authentication

Phone OTP, email, Google & Apple OAuth with JWT tokens

Overview

ETERA uses JWT Bearer tokens for API authentication. Tokens are obtained through one of several authentication methods, then passed in the Authorization header on every request.

$Authorization: Bearer YOUR_JWT_TOKEN

Choose Your Auth Method

Best for mobile apps. 3-step flow using SMS verification.

1

Send OTP

$curl -X POST "https://api.etera.dev/auth/api/auth/phone-number/send-otp" \
> -H "Content-Type: application/json" \
> -d '{
> "phoneNumber": "589595029",
> "countryCode": "+971"
> }'
2

Verify OTP

$curl -X POST "https://api.etera.dev/auth/api/auth/phone-number/verify" \
> -H "Content-Type: application/json" \
> -d '{
> "phoneNumber": "589595029",
> "countryCode": "+971",
> "code": "123456"
> }'
3

Update Profile (new users)

$curl -X PATCH "https://api.etera.dev/auth/api/auth/me" \
> -H "Authorization: Bearer YOUR_JWT_TOKEN" \
> -H "Content-Type: application/json" \
> -d '{ "firstName": "John", "lastName": "Doe", "language": "en" }'

Phone numbers use the number without country code in phoneNumber and the calling code with + prefix in countryCode. Example: UAE +971 58 959 5029 becomes phoneNumber: "589595029", countryCode: "+971".


Using Your Token

Once authenticated, include the JWT in all API requests:

$curl "https://api.etera.dev/restaurant/search/recommendations/" \
> -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."

Get Current User

Retrieve the authenticated user’s profile:

$curl "https://api.etera.dev/auth/api/auth/me" \
> -H "Authorization: Bearer YOUR_JWT_TOKEN"

Security Schemes

Bearer Auth (JWT)

Used by most client-facing endpoints. Obtained through any of the authentication flows above.

ServiceUses Bearer Auth
Auth
Account
Context
Notification

Used for admin-only operations. Passed as a header value.

ServiceUses Admin Secret
Context
AI

Rate Limits

ScopeLimit
Phone/Email OTP5 requests/hour per number or email
Authentication endpoints20 requests/minute per IP
Profile updates10 requests/minute per user
General API100 requests/minute per IP

JWT tokens are stateless — store them securely on the client. Never expose tokens in URLs, localStorage on shared devices, or version control.

Next Steps