|
1 | 1 | /**
|
2 | 2 | * The following endpoints require an OAuth App to authenticate using its client_id and client_secret.
|
3 | 3 | *
|
4 |
| - * - [`POST /applications/{client_id}/token`](https://developer.github.com/v3/apps/oauth_applications/#check-a-token) - Check a token |
5 |
| - * - [`PATCH /applications/{client_id}/token`](https://developer.github.com/v3/apps/oauth_applications/#reset-a-token) - Reset a token |
6 |
| - * - [`DELETE /applications/{client_id}/token`](https://developer.github.com/v3/apps/oauth_applications/#reset-a-token) - Delete an app token |
7 |
| - * - [`DELETE /applications/{client_id}/grant`](https://developer.github.com/v3/apps/oauth_applications/#delete-an-app-authorization) - Delete an app authorization |
| 4 | + * - [`POST /applications/{client_id}/token`](https://docs.github.com/en/rest/reference/apps#check-a-token) - Check a token |
| 5 | + * - [`PATCH /applications/{client_id}/token`](https://docs.github.com/en/rest/reference/apps#reset-a-token) - Reset a token |
| 6 | + * - [`POST /applications/{client_id}/token/scoped`](https://docs.github.com/en/rest/reference/apps#create-a-scoped-access-token) - Create a scoped access token |
| 7 | + * - [`DELETE /applications/{client_id}/token`](https://docs.github.com/en/rest/reference/apps#delete-an-app-token) - Delete an app token |
| 8 | + * - [`DELETE /applications/{client_id}/grant`](https://docs.github.com/en/rest/reference/apps#delete-an-app-authorization) - Delete an app authorization |
8 | 9 | *
|
9 | 10 | * deprecated:
|
10 | 11 | *
|
11 |
| - * - [`GET /applications/{client_id}/tokens/{access_token}`](https://developer.github.com/v3/apps/oauth_applications/#check-an-authorization) - Check an authorization |
12 |
| - * - [`POST /applications/{client_id}/tokens/{access_token}`](https://developer.github.com/v3/apps/oauth_applications/#reset-an-authorization) - Reset an authorization |
13 |
| - * - [`DELETE /applications/{client_id}/tokens/{access_token}`](https://developer.github.com/v3/apps/oauth_applications/#revoke-an-authorization-for-an-application) - Revoke an authorization for an application |
14 |
| - * - [`DELETE /applications/{client_id}/grants/{access_token}`](https://developer.github.com/v3/apps/oauth_applications/#revoke-a-grant-for-an-application) - Revoke a grant for an application |
| 12 | + * - [`GET /applications/{client_id}/tokens/{access_token}`](https://docs.github.com/en/rest/reference/apps#check-an-authorization) - Check an authorization |
| 13 | + * - [`POST /applications/{client_id}/tokens/{access_token}`](https://docs.github.com/en/rest/reference/apps#reset-an-authorization) - Reset an authorization |
| 14 | + * - [`DELETE /applications/{client_id}/tokens/{access_token}`](https://docs.github.com/en/rest/reference/apps#revoke-an-authorization-for-an-application) - Revoke an authorization for an application |
| 15 | + * - [`DELETE /applications/{client_id}/grants/{access_token}`](https://docs.github.com/en/rest/reference/apps#revoke-a-grant-for-an-application) - Revoke a grant for an application |
15 | 16 | */
|
16 |
| -const ROUTES_REQUIRING_BASIC_AUTH = /\/applications\/[:{]?[\w_]+\}?\/(token|grant)(s\/[:{]?[\w_]+\}?)?($|\?)/; |
| 17 | +const ROUTES_REQUIRING_BASIC_AUTH = /\/applications\/[^/]+\/(token|grant)s?/; |
17 | 18 |
|
18 | 19 | export function requiresBasicAuth(url: string | undefined) {
|
19 | 20 | return url && ROUTES_REQUIRING_BASIC_AUTH.test(url);
|
|
0 commit comments