• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

inclusion-numerique / coop-mediation-numerique / 134f1cc8-b272-471e-be1c-25fe3b4baafa

17 Mar 2026 04:15PM UTC coverage: 6.94% (-3.9%) from 10.79%
134f1cc8-b272-471e-be1c-25fe3b4baafa

push

circleci

web-flow
Merge pull request #437 from inclusion-numerique/dev

release

470 of 10426 branches covered (4.51%)

Branch coverage included in aggregate %.

28 of 584 new or added lines in 86 files covered. (4.79%)

1348 existing lines in 161 files now uncovered.

1355 of 15871 relevant lines covered (8.54%)

37.74 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/apps/web/src/app/api/v1/isAuthenticatedApiClientRequest.ts
1
import { authenticateApiCient } from '@app/web/api-client/apiClient'
2
import {
3
  apiV1AuthorizationHeader,
4
  apiV1AuthorizationScheme,
5
} from '@app/web/app/api/v1/apiV1Headers'
6
import { ApiClientScope } from '@prisma/client'
7
import { NextRequest } from 'next/server'
8

UNCOV
9
export const isAuthenticatedApiClientRequest = async (
×
10
  request: NextRequest,
11
  scopes: ApiClientScope[],
12
) => {
13
  // Get api key from header
UNCOV
14
  const authorizationString = request.headers.get(apiV1AuthorizationHeader)
×
15

UNCOV
16
  if (!authorizationString) {
×
UNCOV
17
    return false
×
18
  }
19

UNCOV
20
  const [scheme, value] = authorizationString.split(' ')
×
21

UNCOV
22
  if (scheme !== apiV1AuthorizationScheme) {
×
23
    return false
×
24
  }
25

UNCOV
26
  if (!value) {
×
27
    return false
×
28
  }
29

UNCOV
30
  const [clientId, clientSecret] = value.split(':')
×
31

UNCOV
32
  if (!clientId || !clientSecret) {
×
33
    return false
×
34
  }
35

UNCOV
36
  const client = await authenticateApiCient(clientId, clientSecret)
×
UNCOV
37
  if (!client) {
×
38
    return false
×
39
  }
40

41
  // Ensure that all scopes in parameters are present in the client scopes
UNCOV
42
  for (const scope of scopes) {
×
43
    if (!client.scopes.includes(scope)) {
×
44
      return false
×
45
    }
46
  }
47

UNCOV
48
  return true
×
49
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc