106 $accessToken = $accessToken instanceof
AccessToken ? $accessToken->
getValue() : $accessToken;
107 $params = [
'input_token' => $accessToken];
111 $this->app->getAccessToken(),
118 $response = $this->client->sendRequest($this->lastRequest);
119 $metadata = $response->getDecodedBody();
135 public function getAuthorizationUrl($redirectUrl, $state, array $scope = [], array $params = [], $separator =
'&')
138 'client_id' => $this->app->getId(),
140 'response_type' =>
'code',
142 'redirect_uri' => $redirectUrl,
143 'scope' => implode(
',', $scope)
146 return static::BASE_AUTHORIZATION_URL .
'/' . $this->graphVersion .
'/dialog/oauth?' . http_build_query($params,
null, $separator);
163 'redirect_uri' => $redirectUri,
180 $accessToken = $accessToken instanceof
AccessToken ? $accessToken->
getValue() : $accessToken;
182 'grant_type' =>
'fb_exchange_token',
183 'fb_exchange_token' => $accessToken,
202 'redirect_uri' => $redirectUri,
206 $data = $response->getDecodedBody();
208 if (!isset($data[
'code'])) {
212 return $data[
'code'];
227 $data = $response->getDecodedBody();
229 if (!isset($data[
'access_token'])) {
236 if (isset($data[
'expires'])) {
239 $expiresAt =
time() + $data[
'expires'];
240 } elseif (isset($data[
'expires_in'])) {
244 $expiresAt =
time() + $data[
'expires_in'];
247 return new AccessToken($data[
'access_token'], $expiresAt);
265 $accessToken = $accessToken ?: $this->app->getAccessToken();
277 return $this->client->sendRequest($this->lastRequest);
288 'client_id' => $this->app->getId(),
289 'client_secret' => $this->app->getSecret(),