Description
On localhost everything is ok... but in production embed returns null from Twitter.
class EmbedsController extends Controller
{
public function getEmbedData(Request $request) {
$embed = new Embed();
$embed->setSettings([
'facebook:token' => env('FACEBOOK_TOKEN'),
'instagram:token' => env('INSTAGRAM_TOKEN'),
'twitter:token' => env('TWITTER_TOKEN'),
]);
$embedResponse = $embed->get($request->get('url'));
$embedData = collect([
'provider' => $embedResponse->providerName,
'embed' => $embedResponse->code
]);
\Log::warning($embedData->toJson());
return $embedData->toJson();
}
}
localhost:
[2023-05-29 13:43:14] local.WARNING: {"provider":"Twitter","embed":{"html":"<blockquote class=\"twitter-tweet\"><p lang=\"en\" dir=\"ltr\">\u2694\ufe0f Slaying demons has never been more approachable<br><br>\ud83d\udd25 Sanctuary now has over 50 accessibility features in <a href=\"https:\/\/twitter.com\/hashtag\/DiabloIV?src=hash&ref_src=twsrc%5Etfw\">#DiabloIV<\/a> <br><br>\ud83d\udd17 <a href=\"https:\/\/t.co\/UY9z8bxpbX\">https:\/\/t.co\/UY9z8bxpbX<\/a> <a href=\"https:\/\/t.co\/4HVGgGnJkB\">pic.twitter.com\/4HVGgGnJkB<\/a><\/p>— Blizzard Entertainment (@Blizzard_Ent) <a href=\"https:\/\/twitter.com\/Blizzard_Ent\/status\/1661446975613554693?ref_src=twsrc%5Etfw\">May 24, 2023<\/a><\/blockquote> <script async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script>","width":550,"height":null,"ratio":null}}
production:
[2023-05-29 13:42:46] production.WARNING: {"provider":"Twitter","embed":null}