Instagram embeds.js redirected to login
6

I have embeds on my website generated with the instagram oembed api. However for some reason on Safari on iOS the instagram embeds.js gets redirected to the login page for most users. What can I do to fix this?

Request: https://platform.instagram.com/nl_NL/embeds.js

Redirects to: https://www.instagram.com/embed.js

Redirects to: https://www.instagram.com/accounts/login/?next=https%3A%2F%2Fwww.instagram.com%2Fembed.js

Stef
Asked about 12 months ago
Shinji

I have the same issue.

This redirect seems to occur when Safari's ITP (Intelligent Tracking Prevention) is enabled and cross-site tracking is not possible.

The response at the URL below is expected to be JavaScript, but it is actually HTML, which is why a SyntaxError: Unexpected token '<' is output in the Safari DevTools console: https://www.instagram.com/accounts/login/?next=https%3A%2F%2Fwww.instagram.com%2Fembed.js

June 12 at 6:38 PM
Shinji

add: same error occurs when ITP is disabled but not logged into instagram.com with Safari.

June 13 at 1:33 AM
Selected Answer
3

I can confirm running into the exact same issue. Apart from hearing complaints from users across a range of websites, I also tested it myself on Lambdatest with their real device testing feature:

iPhone 14 Pro Max, IOS 16, Embed code copied straight from Insta: embed.js redirects to login page

June 15 at 4:24 AM
Ruben