@@ -26,37 +26,46 @@ class GitHub extends OAuth2Provider implements CSRFToken, TokenRefresh, UserInfo
26
26
27
27
public const IDENTIFIER = 'GITHUB ' ;
28
28
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
30
30
public const SCOPES_DELIMITER = ', ' ;
31
31
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 ' ;
42
34
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 ' ;
46
40
public const SCOPE_ORG_HOOK_ADMIN = 'admin:org_hook ' ;
47
41
public const SCOPE_ORG_READ = 'read:org ' ;
48
42
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 ' ;
50
49
public const SCOPE_PUBLIC_KEY_READ = 'read:public_key ' ;
51
50
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 ' ;
56
66
57
67
public const DEFAULT_SCOPES = [
58
68
self ::SCOPE_USER ,
59
- self ::SCOPE_USER_EMAIL ,
60
69
self ::SCOPE_PUBLIC_REPO ,
61
70
self ::SCOPE_GIST ,
62
71
];
@@ -66,7 +75,8 @@ class GitHub extends OAuth2Provider implements CSRFToken, TokenRefresh, UserInfo
66
75
];
67
76
68
77
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 ' ,
70
80
];
71
81
72
82
protected string $ authorizationURL = 'https://github.com/login/oauth/authorize ' ;
0 commit comments