Ironic: Apple Music Authorization Pop-up blocked on iPhone

As you know, calling this in Javascript:


let auth = music.authorize();


Opens the authorization menu in a pop-up (when the user has yet to grant permissions to the app).


But the problem here is that Safari is blocking this action *because* of the pop-up.


Anyone had any luck solving it?

Replies

did you ever get this working? I am having a problem with authorize() creating a popup too.

I was able to work around this by disabling Block Pop-ups setting completely (Settings - Safari - Block Pop-ups) but this is definitely not a right solution. Chrome blocks it on desktop as well and you need to click on the notification in address bar to allow it.


Any suggestions or future plans from Apple to solve this issue?

You are correct this is not the right solution. Are you able to post a code sample / JS Fiddle of your implemention that is causing this issue?


Thanks!


Jae

I've been making a snippet for jaehess and I think I realized what is the problem. If you call music.authorize() on page load the popup gets blocked by the browser. However if it's done in response to user's activity (e.g. when a button is clicked) it doesn't.

Has anyone gotten auth to work without a popup? I'm trying to create a web app on a Tesla browser that doesn't allow popups.

Does it still block the popup if you call autorize() in a button click handler? I don't know much about Tesla browser but it's Chromium so should behave pretty much same to Chrome or Safari.

Hi @vgorbenko thanks for the reply.


So with the Tesla infotainment screen browser, there's no concept of tabs or popups. And you're correct, it now uses Chromium (which is great). However when authorize() is called from a button click handler and no popup system is available, it opens a blank white page that fails to load anything. It is however loading a page on the apple server, it's just blank.