fix: align OTP auth with actual API response format #28

Closed
schwifty wants to merge 0 commits from schwifty/fix-otp-auth into main
Collaborator

Summary

  • Bug 1: sendOTP was sending ContactNumber but the API expects Phone — phone was always empty, causing invalid phone error
  • Bug 2: APIResponse expected {"Success": true, "Data": {...}} but auth endpoints return {"OK": true, "UUID": "..."} — decode always failed, success defaulted to false
  • Bug 3: verifyOTP was sending Code but the API expects OTP

Now uses dedicated OTPRawResponse and VerifyOTPRawResponse structs that match the actual API format instead of the generic APIResponse wrapper.

Test plan

  • Build in Xcode (DEBUG → dev server, RELEASE → prod)
  • Enter phone number → Send OTP → should succeed and show OTP field
  • Enter 123456 (magic OTP) → Verify → should log in
  • Test with real OTP on prod build

🤖 Generated with Claude Code

## Summary - **Bug 1**: `sendOTP` was sending `ContactNumber` but the API expects `Phone` — phone was always empty, causing invalid phone error - **Bug 2**: `APIResponse` expected `{"Success": true, "Data": {...}}` but auth endpoints return `{"OK": true, "UUID": "..."}` — decode always failed, `success` defaulted to `false` - **Bug 3**: `verifyOTP` was sending `Code` but the API expects `OTP` Now uses dedicated `OTPRawResponse` and `VerifyOTPRawResponse` structs that match the actual API format instead of the generic `APIResponse` wrapper. ## Test plan - [ ] Build in Xcode (DEBUG → dev server, RELEASE → prod) - [ ] Enter phone number → Send OTP → should succeed and show OTP field - [ ] Enter 123456 (magic OTP) → Verify → should log in - [ ] Test with real OTP on prod build 🤖 Generated with [Claude Code](https://claude.com/claude-code)
schwifty added 1 commit 2026-03-22 20:47:11 +00:00
Three bugs found and fixed:
1. sendOTP was sending "ContactNumber" but API expects "Phone"
2. APIResponse expected {"Success":true,"Data":{}} but API returns {"OK":true,"UUID":"..."}
3. verifyOTP was sending "Code" but API expects "OTP"

Now decodes the raw API format directly instead of going through the
generic APIResponse wrapper (which doesn't match auth endpoints).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
schwifty closed this pull request 2026-03-22 22:32:48 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: payfrit/payfrit-beacon-ios#28
No description provided.