From dfbb8d09fd8a8d798bfa2f5d09dcbdd0c493dabb Mon Sep 17 00:00:00 2001 From: Nathan Lie Date: Wed, 21 Feb 2024 14:44:08 -0800 Subject: [PATCH] fix: update error messages in grant routes --- packages/auth/src/grant/routes.test.ts | 11 ++++++----- packages/auth/src/grant/routes.ts | 8 ++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/auth/src/grant/routes.test.ts b/packages/auth/src/grant/routes.test.ts index 631639581f..83ea65e602 100644 --- a/packages/auth/src/grant/routes.test.ts +++ b/packages/auth/src/grant/routes.test.ts @@ -198,8 +198,9 @@ describe('Grant Routes', (): void => { ).rejects.toMatchObject({ status: 400, error: { - code: 'interaction_required', - description: 'missing required request field' + code: 'invalid_request', + description: + "missing required request field 'interact'" } }) } else { @@ -338,8 +339,8 @@ describe('Grant Routes', (): void => { await expect(grantRoutes.create(ctx)).rejects.toMatchObject({ status: 400, error: { - code: 'interaction_required', - description: 'missing required request field' + code: 'invalid_request', + description: "missing required request field 'interact'" } }) }) @@ -441,7 +442,7 @@ describe('Grant Routes', (): void => { status: 400, error: { code: 'invalid_client', - description: 'missing required request field' + description: "missing required request field 'client'" } }) }) diff --git a/packages/auth/src/grant/routes.ts b/packages/auth/src/grant/routes.ts index 1940a6201c..7cfa3bc74b 100644 --- a/packages/auth/src/grant/routes.ts +++ b/packages/auth/src/grant/routes.ts @@ -154,10 +154,10 @@ async function createPendingGrant( const { body } = ctx.request const { grantService, interactionService, config } = deps if (!body.interact) { - ctx.throw(400, 'interaction_required', { + ctx.throw(400, 'invalid_request', { error: { - code: 'interaction_required', - description: 'missing required request field' + code: 'invalid_request', + description: "missing required request field 'interact'" } }) } @@ -167,7 +167,7 @@ async function createPendingGrant( ctx.throw(400, 'invalid_client', { error: { code: 'invalid_client', - description: 'missing required request field' + description: "missing required request field 'client'" } }) }