Skip to content

Commit 5100f06

Browse files
authored
Merge pull request #577 from IanSimpson/master
Access tokens are now optional with Meta
2 parents d2e5d01 + fbc2e1d commit 5100f06

2 files changed

Lines changed: 6 additions & 14 deletions

File tree

src/Adapters/Facebook/OEmbed.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,14 @@
88

99
class OEmbed extends Base
1010
{
11-
const ENDPOINT_PAGE = 'https://graph.facebook.com/v11.0/oembed_page';
12-
const ENDPOINT_POST = 'https://graph.facebook.com/v11.0/oembed_post';
13-
const ENDPOINT_VIDEO = 'https://graph.facebook.com/v11.0/oembed_video';
11+
const ENDPOINT_PAGE = 'https://graph.facebook.com/v25.0/oembed_page';
12+
const ENDPOINT_POST = 'https://graph.facebook.com/v25.0/oembed_post';
13+
const ENDPOINT_VIDEO = 'https://graph.facebook.com/v25.0/oembed_video';
1414

1515
protected function detectEndpoint(): ?UriInterface
1616
{
1717
$token = $this->extractor->getSetting('facebook:token');
1818

19-
if (!is_string($token) || $token === '') {
20-
return null;
21-
}
22-
2319
$uri = $this->extractor->getUri();
2420
if (strpos($uri->getPath(), 'login') !== false) {
2521
parse_str($uri->getQuery(), $params);
@@ -28,7 +24,7 @@ protected function detectEndpoint(): ?UriInterface
2824
}
2925
}
3026
$queryParameters = $this->getOembedQueryParameters((string) $uri);
31-
$queryParameters['access_token'] = $token;
27+
if($token) $queryParameters['access_token'] = $token;
3228

3329
return $this->extractor->getCrawler()
3430
->createUri($this->getEndpointByPath($uri->getPath()))

src/Adapters/Instagram/OEmbed.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,19 @@
88

99
class OEmbed extends Base
1010
{
11-
const ENDPOINT = 'https://graph.facebook.com/v8.0/instagram_oembed';
11+
const ENDPOINT = 'https://graph.facebook.com/v25.0/instagram_oembed';
1212

1313
protected function detectEndpoint(): ?UriInterface
1414
{
1515
$token = $this->extractor->getSetting('instagram:token');
1616

17-
if (!is_string($token) || $token === '') {
18-
return null;
19-
}
20-
2117
$uri = $this->extractor->getUri();
2218
if (strpos($uri->getPath(), 'login') !== false) {
2319
$uri = $this->extractor->getRequest()->getUri();
2420
}
2521

2622
$queryParameters = $this->getOembedQueryParameters((string) $uri);
27-
$queryParameters['access_token'] = $token;
23+
if($token) $queryParameters['access_token'] = $token;
2824

2925
return $this->extractor->getCrawler()
3026
->createUri(self::ENDPOINT)

0 commit comments

Comments
 (0)