1

SoundCloud SDK v3.1.2

我大约 1 年前注册了我的应用程序。

今天我发现我的 SoundCloud (SC) 登录停止工作。

当我单击按钮时,SC 弹出窗口出现消息“允许“domain.com”访问您的 SoundCloud 帐户? ”我单击connect并收到带有消息的回调弹出窗口“此弹出窗口应在几秒钟内自动关闭”。回调弹出窗口永远不会关闭。在开发控制台(用于回调弹出窗口)中,我看到以下错误:

铬 55.0.2883.87 m(64 位) VM2980 callback.html?code=3717208…&state=SoundCloud_Dialog_508d9:7 Uncaught DOMException: Blocked a frame with origin "http://domain.com" from accessing a cross-origin frame. at onload (http://domain.com/callback.html?code=3717208cc602aba6cc0195157ecd2b6b&state…8d9#access_token=1-166020-17988851-e8f6b064d7ccd4&scope=non-expiring:7:105) onload @ VM2980 callback.html?code=3717208…&state=SoundCloud_Dialog_508d9:7

火狐 50.1.0 Error: Permission denied to access property "SC" callback.html:1:1 了解更多

我的回调.html:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Connect with SoundCloud</title>
  </head>
  <body onload="window.setTimeout(window.opener.SC.connectCallback, 1);">
    <p>
      This popup should automatically close in a few seconds
    </p>
  </body>
</html>

由我页面上的按钮触发的 JavaScript 函数(在 AngularJS 1.6 组件控制器中):

... 
      this.connect_sc = function () {
        debugger;
      // initiate auth popup
        SC.connect().then(function () {
          debugger;
          return SC.get('/me');
        }).then(function (me) {
          debugger;
          userPerma = me.permalink;
          setScUi(me.username, me.avatar_url);
          getPlaylists();
        });
      };
...

我试图调试它放置一些断点。在这里,我没有执行 SC 承诺,它仅在debugger;我单击按钮后的第一次中断。

为什么会这样以及如何解决?

4

1 回答 1

0

对我来说同样的问题。

我用重定向修复了它。当我在没有“www”的网站上时,它不起作用,因为回调是用“www”注册的。

我添加了一个重定向,让我的网站只有“www”,现在效果很好!

希望它会有所帮助。

于 2017-01-26T14:15:18.880 回答