2016-03-23 48 views
0

我正在尝试为Web应用程序设置SoundCloud SDK。 我设法得到一个弹出式窗口要求授权与下面的代码,点击连接,但它没有回应。如何为Web应用程序设置Javascript Soundcloud SDK

任何人都可以看到这个问题吗? 这是Javascript。

SC.initialize({ 
      client_id: 'mygeneratedid', 
      redirect_uri: 'file:///Users/simonmellows/Documents/Music%20Tech%20(Year%203)/Individual%20Project/Work/GUI%20Design.html' 
     }); 

     // initiate auth popup 
      SC.connect().then(function() { 
      return SC.get('/me'); 
     }).then(function(me) { 
      alert('Hello, ' + me.username); 
      }); 

这是我的callback.html。

<!DOCTYPE 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> 

我在我的电脑上运行该文件,它不在其他地方托管。它是否需要在本地托管?甚至在远程服务器上工作? 任何意见将不胜感激。上面的代码就是我从文档中找到的。

谢谢!

回答

0

开始与您指定为“REDIRECT_URI”必须匹配您的重定向URI的注册应用程序页面上soundcloud.com输入验证值(这一点,您可以查看同一个地方的价值你的客户端密码为&)。

重定向URI必须是soundcloud可以解析和访问的地址。

相关问题