Skip to content

Add Zod Validation for Authentication Utility Endpoints #540

@Harxhit

Description

@Harxhit

Summary

Add request validation for authentication utility endpoints to ensure request payloads are validated before processing sensitive authentication operations.

Contexts

The authentication utility endpoints currently accept request payloads without Zod validation. Since these endpoints handle refresh tokens and mobile authentication exchanges, input validation should be enforced to improve security, consistency, and maintainability.

Tasks

  • Create Zod schema for POST /auth/mobile/exchange
  • Validate exchange code payload before processing
  • Create Zod schema for POST /auth/refresh
  • Validate refresh token payload when provided in request body
  • Return standardized validation errors for invalid requests
  • Add/update tests for validation failures and successful requests

Acceptance Criteria

  • Invalid mobile exchange requests are rejected with validation errors
  • Invalid refresh requests are rejected with validation errors
  • POST /auth/mobile/exchange uses Zod validation
  • POST /auth/refresh uses Zod validation
  • Tests added for validation success and failure cases
  • Documentation updated if necessary

Area

backend

Difficulty

Easy

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

Status
In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions