Skip to content

Commit 9c34b2d

Browse files
ralyodioclaude
andcommitted
fix(api): correct Next.js App Router handler signatures for key-backup and backup-pin
GET/POST/PUT handlers were receiving `{ request }` (destructuring the Request object, giving undefined) instead of `request` directly. This caused every auth check to throw, fall into the catch block, and return 401 Unauthorized — breaking server key backup save, restore, and the backup-exists check on the settings page. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 32260f2 commit 9c34b2d

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/app/api/auth/backup-pin/route.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ async function hashPin(pin) {
100100
* GET /api/auth/backup-pin
101101
* Check if the authenticated user has a backup PIN set
102102
*/
103-
export async function GET({ request }) {
103+
export async function GET(request) {
104104
try {
105105
const { user, error: authError } = await authenticateUser(request);
106106
if (authError || !user) {
@@ -129,7 +129,7 @@ export async function GET({ request }) {
129129
* POST /api/auth/backup-pin
130130
* Set or update the backup PIN for the authenticated user
131131
*/
132-
export async function POST({ request }) {
132+
export async function POST(request) {
133133
try {
134134
const { user, error: authError } = await authenticateUser(request);
135135
if (authError || !user) {

src/app/api/auth/key-backup/route.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ async function authenticateUser(request) {
9191
* GET /api/auth/key-backup
9292
* Fetch the authenticated user's encrypted key backup
9393
*/
94-
export async function GET({ request }) {
94+
export async function GET(request) {
9595
try {
9696
const { user, error: authError } = await authenticateUser(request);
9797
if (authError || !user) {
@@ -131,7 +131,7 @@ export async function GET({ request }) {
131131
* PUT /api/auth/key-backup
132132
* Store or update the authenticated user's encrypted key backup
133133
*/
134-
export async function PUT({ request }) {
134+
export async function PUT(request) {
135135
try {
136136
const { user, error: authError } = await authenticateUser(request);
137137
if (authError || !user) {

0 commit comments

Comments
 (0)