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