Skip to content

Commit c9fc9af

Browse files
committed
:octocat: GitHub: scopes update
1 parent f4def48 commit c9fc9af

File tree

1 file changed

+31
-21
lines changed

1 file changed

+31
-21
lines changed

src/Providers/GitHub.php

+31-21
Original file line numberDiff line numberDiff line change
@@ -26,37 +26,46 @@ class GitHub extends OAuth2Provider implements CSRFToken, TokenRefresh, UserInfo
2626

2727
public const IDENTIFIER = 'GITHUB';
2828

29-
// GitHub accepts both, comma and space, but the scopes in the token response are only comma separated
29+
// GitHub accepts both, comma and space, but the normalized scopes in the token response are only comma separated
3030
public const SCOPES_DELIMITER = ',';
3131

32-
public const SCOPE_USER = 'user';
33-
public const SCOPE_USER_EMAIL = 'user:email';
34-
public const SCOPE_USER_FOLLOW = 'user:follow';
35-
public const SCOPE_PUBLIC_REPO = 'public_repo';
36-
public const SCOPE_REPO = 'repo';
37-
public const SCOPE_REPO_DEPLOYMENT = 'repo_deployment';
38-
public const SCOPE_REPO_STATUS = 'repo:status';
39-
public const SCOPE_REPO_INVITE = 'repo:invite';
40-
public const SCOPE_REPO_DELETE = 'delete_repo';
41-
public const SCOPE_NOTIFICATIONS = 'notifications';
32+
// @link https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/scopes-for-oauth-apps#available-scopes
33+
public const SCOPE_CODESPACE = 'codespace';
4234
public const SCOPE_GIST = 'gist';
43-
public const SCOPE_REPO_HOOK_READ = 'read:repo_hook';
44-
public const SCOPE_REPO_HOOK_WRITE = 'write:repo_hook';
45-
public const SCOPE_REPO_HOOK_ADMIN = 'admin:repo_hook';
35+
public const SCOPE_GPG_KEY_ADMIN = 'admin:gpg_key';
36+
public const SCOPE_GPG_KEY_READ = 'read:gpg_key';
37+
public const SCOPE_GPG_KEY_WRITE = 'write:gpg_key';
38+
public const SCOPE_NOTIFICATIONS = 'notifications';
39+
public const SCOPE_ORG_ADMIN = 'admin:org';
4640
public const SCOPE_ORG_HOOK_ADMIN = 'admin:org_hook';
4741
public const SCOPE_ORG_READ = 'read:org';
4842
public const SCOPE_ORG_WRITE = 'write:org';
49-
public const SCOPE_ORG_ADMIN = 'admin:org';
43+
public const SCOPE_PACKAGES_DELETE = 'delete:packages';
44+
public const SCOPE_PACKAGES_READ = 'read:packages';
45+
public const SCOPE_PACKAGES_WRITE = 'write:packages';
46+
public const SCOPE_PROJECT = 'project';
47+
public const SCOPE_PROJECT_READ = 'read:project';
48+
public const SCOPE_PUBLIC_KEY_ADMIN = 'admin:public_key';
5049
public const SCOPE_PUBLIC_KEY_READ = 'read:public_key';
5150
public const SCOPE_PUBLIC_KEY_WRITE = 'write:public_key';
52-
public const SCOPE_PUBLIC_KEY_ADMIN = 'admin:public_key';
53-
public const SCOPE_GPG_KEY_READ = 'read:gpg_key';
54-
public const SCOPE_GPG_KEY_WRITE = 'write:gpg_key';
55-
public const SCOPE_GPG_KEY_ADMIN = 'admin:gpg_key';
51+
public const SCOPE_PUBLIC_REPO = 'public_repo';
52+
public const SCOPE_REPO = 'repo';
53+
public const SCOPE_REPO_DELETE = 'delete_repo';
54+
public const SCOPE_REPO_DEPLOYMENT = 'repo_deployment';
55+
public const SCOPE_REPO_HOOK_ADMIN = 'admin:repo_hook';
56+
public const SCOPE_REPO_HOOK_READ = 'read:repo_hook';
57+
public const SCOPE_REPO_HOOK_WRITE = 'write:repo_hook';
58+
public const SCOPE_REPO_INVITE = 'repo:invite';
59+
public const SCOPE_REPO_STATUS = 'repo:status';
60+
public const SCOPE_SECURITY_EVENTS = 'security_events';
61+
public const SCOPE_USER = 'user';
62+
public const SCOPE_USER_EMAIL = 'user:email';
63+
public const SCOPE_USER_FOLLOW = 'user:follow';
64+
public const SCOPE_USER_READ = 'read:user';
65+
public const SCOPE_WORKFLOW = 'workflow';
5666

5767
public const DEFAULT_SCOPES = [
5868
self::SCOPE_USER,
59-
self::SCOPE_USER_EMAIL,
6069
self::SCOPE_PUBLIC_REPO,
6170
self::SCOPE_GIST,
6271
];
@@ -66,7 +75,8 @@ class GitHub extends OAuth2Provider implements CSRFToken, TokenRefresh, UserInfo
6675
];
6776

6877
public const HEADERS_API = [
69-
'Accept' => 'application/vnd.github.beta+json',
78+
'Accept' => 'application/vnd.github+json',
79+
'X-GitHub-Api-Version' => '2022-11-28',
7080
];
7181

7282
protected string $authorizationURL = 'https://github.com/login/oauth/authorize';

0 commit comments

Comments
 (0)