Invalid redirect URI for spotify

左心房为你撑大大i 提交于 2019-12-01 06:50:20

There are several ways you can do it. I recommend you to have a look at the possan/webapi-player-example, which is built using AngularJS and uses a PostMessage to communicate between the redirect URI (callback.html) and the Angular app (app.js).

If PostMessages is not an option, you can try this:

  1. Start a loop to check a certain key on localStorage
  2. Open the login page in a popup.
  3. From the callback page, write in localStorage the data you get back from Spotify (i.e. access_token, refresh_token, expires_in).
  4. Close the popup after a couple of seconds
  5. The loop should have realised about the new value being written in localStorage.

The previous flow, although a bit more complex, works well in environments such as iOS devices where it is sometimes impossible to communicate between the callback page and the "main" page properly.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!