Skip to content

Commit

Permalink
feat(auth): return GNAP 404 error if token cannot be rotated
Browse files Browse the repository at this point in the history
  • Loading branch information
golobitch committed Nov 17, 2024
1 parent be426fa commit f053a0c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/auth/src/accessToken/routes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,12 +484,12 @@ describe('Access Token Routes', (): void => {
)
})

test('Returns status 400 if could not rotate token', async (): Promise<void> => {
test('Returns status 404 if could not rotate token', async (): Promise<void> => {
const ctx = createTokenHttpSigContext(token, grant)
jest.spyOn(accessTokenService, 'rotate').mockResolvedValueOnce(undefined)

await expect(accessTokenRoutes.rotate(ctx)).rejects.toMatchObject({
status: 400,
status: 404,
code: GNAPErrorCode.InvalidRotation,
message: 'invalid access token'
})
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/accessToken/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ async function rotateToken(
const errorMessage =
error instanceof Error ? error.message : 'Could not rotate token'
throw new GNAPServerRouteError(
400,
404,
GNAPErrorCode.InvalidRotation,
errorMessage
)
Expand Down

0 comments on commit f053a0c

Please sign in to comment.