1 | <?php |
||
9 | class Instagram extends AbstractProvider |
||
10 | { |
||
11 | /** |
||
12 | * @var string Key used in a token response to identify the resource owner. |
||
13 | */ |
||
14 | const ACCESS_TOKEN_RESOURCE_OWNER_ID = 'user.id'; |
||
15 | |||
16 | /** |
||
17 | * Default scopes |
||
18 | * |
||
19 | * @var array |
||
20 | */ |
||
21 | public $defaultScopes = ['basic']; |
||
22 | |||
23 | /** |
||
24 | * Default host |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $host = 'https://api.instagram.com'; |
||
29 | |||
30 | /** |
||
31 | * Gets host. |
||
32 | * |
||
33 | * @return string |
||
34 | */ |
||
35 | 4 | public function getHost() |
|
39 | |||
40 | /** |
||
41 | * Get the string used to separate scopes. |
||
42 | * |
||
43 | * @return string |
||
44 | */ |
||
45 | 6 | protected function getScopeSeparator() |
|
49 | |||
50 | /** |
||
51 | * Get authorization url to begin OAuth flow |
||
52 | * |
||
53 | * @return string |
||
54 | */ |
||
55 | 6 | public function getBaseAuthorizationUrl() |
|
59 | |||
60 | /** |
||
61 | * Get access token url to retrieve token |
||
62 | * |
||
63 | * @param array $params |
||
64 | * |
||
65 | * @return string |
||
66 | */ |
||
67 | 12 | public function getBaseAccessTokenUrl(array $params) |
|
71 | |||
72 | /** |
||
73 | * Get provider url to fetch user details |
||
74 | * |
||
75 | * @param AccessToken $token |
||
76 | * |
||
77 | * @return string |
||
78 | */ |
||
79 | 2 | public function getResourceOwnerDetailsUrl(AccessToken $token) |
|
83 | |||
84 | /** |
||
85 | * Returns an authenticated PSR-7 request instance. |
||
86 | * |
||
87 | * @param string $method |
||
88 | * @param string $url |
||
89 | * @param AccessToken|string $token |
||
90 | * @param array $options Any of "headers", "body", and "protocolVersion". |
||
91 | * |
||
92 | * @return \Psr\Http\Message\RequestInterface |
||
93 | */ |
||
94 | 4 | public function getAuthenticatedRequest($method, $url, $token, array $options = []) |
|
113 | |||
114 | /** |
||
115 | * Get the default scopes used by this provider. |
||
116 | * |
||
117 | * This should not be a complete list of all scopes, but the minimum |
||
118 | * required for the provider user interface! |
||
119 | * |
||
120 | * @return array |
||
121 | */ |
||
122 | 4 | protected function getDefaultScopes() |
|
126 | |||
127 | /** |
||
128 | * Check a provider response for errors. |
||
129 | * |
||
130 | * @link https://instagram.com/developer/endpoints/ |
||
131 | * @throws IdentityProviderException |
||
132 | * @param ResponseInterface $response |
||
133 | * @param string $data Parsed response data |
||
134 | * @return void |
||
135 | */ |
||
136 | 10 | protected function checkResponse(ResponseInterface $response, $data) |
|
148 | |||
149 | /** |
||
150 | * Generate a user object from a successful user details request. |
||
151 | * |
||
152 | * @param array $response |
||
153 | * @param AccessToken $token |
||
154 | * @return ResourceOwnerInterface |
||
155 | */ |
||
156 | 2 | protected function createResourceOwner(array $response, AccessToken $token) |
|
160 | |||
161 | /** |
||
162 | * Sets host. |
||
163 | * |
||
164 | * @param string $host |
||
165 | * |
||
166 | * @return string |
||
167 | */ |
||
168 | 2 | public function setHost($host) |
|
174 | } |
||
175 |