1 | <?php |
||
21 | class Discord extends AbstractProvider |
||
22 | { |
||
23 | use BearerAuthorizationTrait; |
||
24 | |||
25 | /** |
||
26 | * API Domain |
||
27 | * |
||
28 | * @var string |
||
29 | */ |
||
30 | public $apiDomain = 'https://discordapp.com/api/v6'; |
||
31 | |||
32 | /** |
||
33 | * Get authorization URL to begin OAuth flow |
||
34 | * |
||
35 | * @return string |
||
36 | */ |
||
37 | 9 | public function getBaseAuthorizationUrl() |
|
41 | |||
42 | /** |
||
43 | * Get access token URL to retrieve token |
||
44 | * |
||
45 | * @param array $params |
||
46 | * |
||
47 | * @return string |
||
48 | */ |
||
49 | 12 | public function getBaseAccessTokenUrl(array $params) |
|
53 | |||
54 | /** |
||
55 | * Get provider URL to retrieve user details |
||
56 | * |
||
57 | * @param AccessToken $token |
||
58 | * |
||
59 | * @return string |
||
60 | */ |
||
61 | 3 | public function getResourceOwnerDetailsUrl(AccessToken $token) |
|
65 | |||
66 | /** |
||
67 | * Returns the string that should be used to separate scopes when building |
||
68 | * the URL for requesting an access token. |
||
69 | * |
||
70 | * Discord's scope separator is space (%20) |
||
71 | * |
||
72 | * @return string Scope separator |
||
73 | */ |
||
74 | 9 | protected function getScopeSeparator() |
|
78 | |||
79 | /** |
||
80 | * Get the default scopes used by this provider. |
||
81 | * |
||
82 | * This should not be a complete list of all scopes, but the minimum |
||
83 | * required for the provider user interface! |
||
84 | * |
||
85 | * @return array |
||
86 | */ |
||
87 | 6 | protected function getDefaultScopes() |
|
97 | |||
98 | /** |
||
99 | * Check a provider response for errors. |
||
100 | * |
||
101 | * @throws IdentityProviderException |
||
102 | * @param ResponseInterface @response |
||
103 | * @param array $data Parsed response data |
||
104 | * @return void |
||
105 | */ |
||
106 | 9 | protected function checkResponse(ResponseInterface $response, $data) |
|
112 | |||
113 | /** |
||
114 | * Generate a user object from a successful user details request. |
||
115 | * |
||
116 | * @param array $response |
||
117 | * @param AccessToken $token |
||
118 | * @return \League\OAuth2\Client\Provider\ResourceOwnerInterface |
||
119 | */ |
||
120 | 3 | protected function createResourceOwner(array $response, AccessToken $token) |
|
124 | } |
||
125 |