Skip to content

Commit bbe810a

Browse files
committed
Make sure authenticateApiRequestWithFailure always returns a result
1 parent a397902 commit bbe810a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

apps/webapp/app/services/apiAuth.server.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,14 @@ export async function authenticateApiRequest(
7171
export async function authenticateApiRequestWithFailure(
7272
request: Request,
7373
options: { allowPublicKey?: boolean; allowJWT?: boolean } = {}
74-
): Promise<ApiAuthenticationResult | undefined> {
74+
): Promise<ApiAuthenticationResult> {
7575
const apiKey = getApiKeyFromRequest(request);
7676

7777
if (!apiKey) {
78-
return;
78+
return {
79+
ok: false,
80+
error: "Invalid API Key",
81+
};
7982
}
8083

8184
const authentication = await authenticateApiKeyWithFailure(apiKey, options);

0 commit comments

Comments
 (0)