我正在尝试使用javascript SDK进行基本身份验证。
callback.html
<!DOCTPYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Connect with SoundCloud</title>
</head>
<body onload="window.setTimeout(window.opener.SC.connectCallback, 1)">
<b style="text-align: center;">This popup should automatically close in a few seconds</b>
</body>
</html>
和我的脚本调用它:
SC.initialize({
client_id: /*MY CLIENT ID*/,
redirect_uri: 'http://www.sc-app.co.nf/callback.html'
});
function connectSC() {
SC.connect().then(function () {
return SC.get('/me');
}).then(function (me) {
alert('Hello, ' + me.username);
});
}
检查它始终显示的控制台日志 '未捕获的TypeError:无法读取未定义'
的属性'connectCallback'答案 0 :(得分:0)
插入头部
<script src="https://connect.soundcloud.com/sdk/sdk-3.0.0.js"></script>