Fix missing refresh_token_hmac_key in models.Session ๐ Issue Reference
๐ Issue Reference
Fixes supabase/auth issue #2270 โ *"missing destination name refresh_token_hmac_key in models.Session" during session refresh on iOS (Swift SDK).
๐ Summary
This PR adds the missing refresh_token_hmac_key field to the models.Session struct with the correct db:"refresh_token_hmac_key" tag. The Supabase Auth server returns this column in queries, but the Go model previously lacked the corresponding destination field, causing scan errors:
500: missing destination name refresh_token_hmac_key in *models.Session
Adding this field ensures the database scanner can correctly bind the column, resolving refresh session failures in Swift and other clients.
โ Changes Included
- Added
RefreshTokenHmacKey *string \db:"refresh_token_hmac_key"``tomodels.Session. - Ensured struct now matches the schema of
auth.sessionstable.
๐ Root Cause
The auth.sessions table includes a column named refresh_token_hmac_key.
However, models.Session did not include the corresponding field, resulting in a mismatched struct during DB row scan and triggering the scanning error.
๐งช Testing
- Verified no duplicate
Sessionstructs exist usinggit grep. - Confirmed that scanning a row from
auth.sessionsinto the updated struct completes without errors. - Manual test: refreshed session after 1 hour; no 500 errors observed.
๐ฆ Deployment Notes
- Requires rebuild and redeploy of Supabase Auth service.
- After deployment, session refresh via /token endpoint functions normally.
๐ Checklist
- [x] Field added to
models.Sessionwith correct database tag. - [x] Code compiles successfully.
- [x] Integration test / manual test for scanning sessions.
- [x] PR linked to issue #2270.
- [x] No breaking changes introduced.