I am testing the following example to authenticate a user by logging in and redirecting to the auth screen - http://jsfiddle.net/JMPerez/j1sqq4g0/
This example uses a callback page with the following script:
(function() {
var hash = {};
window.location.hash.replace(/^#\/?/, '').split('&').forEach(function(kv) {
var spl = kv.indexOf('=');
if (spl != -1) {
hash[kv.substring(0, spl)] = decodeURIComponent(kv.substring(spl+1));
}
});
console.log('initial hash', hash);
if (hash.access_token) {
window.opener.postMessage(
JSON.stringify({
type:'access_token',
access_token: hash.access_token,
expires_in: hash.expires_in || 0
}),
'http://fiddle.jshell.net'
);
window.close();
}
})();
When trying on mobile, it will open a new tab in Safari. Is it possible to check if the app if installed on iOS and login via that instead? Will make the process much quicker.
As seen in an issue here, it seems resolved but cannot understand what is triggering it to do so? - https://github.com/spotify/web-api/issues/718
Thanks!
Spotify app
then it should launch the app. I suspect that the login link is a universal link and it should open the Spotify App. – Nutation