更新时间:2023-12-04 13:14:10
有几种方法可以做到.我建议您看看 possan/webapi-player-example 使用AngularJS构建,并使用PostMessage
在重定向URI(callback.html
)和Angular应用(app.js
)之间进行通信.
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
).
如果没有PostMessages选项,则可以尝试以下操作:
If PostMessages is not an option, you can try this:
localStorage
localStorage
从Spotify获得的数据(即access_token
,refresh_token
,expires_in
).localStorage
localStorage
the data you get back from Spotify (i.e. access_token
, refresh_token
, expires_in
).先前的流程虽然稍微复杂一点,但在诸如iOS设备之类的环境中效果很好,有时无法正确地在回调页面和主"页面之间进行通信.
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.