1
我正在制作仪表板并从SoundCloud API中提取一些信息。我对这个API相对比较陌生,并且我能够将每个音轨的SoundCloud Widget列出。我的问题是,每次刷新时,我都会退出(我认为)。即使用户例如刷新页面,会话仍然存在吗?这是我现在所拥有的:JS:如何防止在SoundCloud API中登录后每次刷新丢失会话
function connectToSoundCloud(){
//INTIALIZE AUTH WITH SC
SC.initialize({
client_id: sc_client_id,
redirect_uri: sc_redirect_uri
});
//INITIATE AUTH POPUP
SC.connect(function() {
SC.get('/me', function(me) {
if (me.username) {
document.getElementById('btn-disconnectFromSoundCloud').style.display="";
document.getElementById('btn-connectToSoundCloud').style.display="none";
}
$.ajax({
type: "GET",
url: "http://api.soundcloud.com/tracks.json?client_id="+sc_client_id+"",
error: function(result, status){
},
success: function(result, status){
//CODE TO DISPLAY TRACKS HERE
}
});
});
});
}
任何帮助表示赞赏。干杯。
这样可以保存正在发送的用户数据,但这样做是否也确保它们已登录?是否仍然上传和评论功能? – theptrk