Skip to content

Commit 563f796

Browse files
authored
Merge pull request #451 from JanMisker/patch-1
Follow Facebook login redirect
2 parents 68fe4ba + 443805a commit 563f796

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Adapters/Facebook/OEmbed.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
class OEmbed extends Base
1010
{
11-
const ENDPOINT_PAGE = 'https://graph.facebook.com/v8.0/oembed_page';
12-
const ENDPOINT_POST = 'https://graph.facebook.com/v8.0/oembed_post';
13-
const ENDPOINT_VIDEO = 'https://graph.facebook.com/v8.0/oembed_video';
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';
1414

1515
protected function detectEndpoint(): ?UriInterface
1616
{
@@ -21,6 +21,12 @@ protected function detectEndpoint(): ?UriInterface
2121
}
2222

2323
$uri = $this->extractor->getUri();
24+
if (strpos($uri->getPath(), 'login') !== false) {
25+
parse_str($uri->getQuery(), $params);
26+
if (!empty($params['next'])) {
27+
$uri = $this->extractor->getCrawler()->createUri($params['next']);
28+
}
29+
}
2430
$queryParameters = $this->getOembedQueryParameters((string) $uri);
2531
$queryParameters['access_token'] = $token;
2632

0 commit comments

Comments
 (0)