I am trying to get OAuth authentication done inside a Spotify app. By default, window.open is blocked, and I am not sure if there is any way to work around that. So, I was wondering what is the best way to handle that. I want to be able to do the following:
1) Redirect the user to the auth link
2) Once they’re authenticated, I want to be able to get notified to handle the return URL and extract the access token from it.
A few options, I am considering: 1) IFrame 2) $.ajax() -- problem is, this doesn't seem to load all javascript/css files from the auth url properly.
Any suggestions?
I believe the
auth.showAuthenticationDialog()API is just what you’re after. It’ll pop up a dialog for you showing the given URL, then give you back the parameters when the return URL is called. Documentation here.