的SoundCloud:callback.html弹出窗口不会关闭 [英] SoundCloud: callback.html popup doesn't close
问题描述
我想实现的SoundCloud JS例如code与callback.htmlAPI
https://developers.soundcloud.com/docs/api/sdks#authentication http://connect.soundcloud.com/examples/recording.html
I'm trying to implement the SoundCloud JS example code with the "callback.html" API https://developers.soundcloud.com/docs/api/sdks#authentication http://connect.soundcloud.com/examples/recording.html
当我上传一个记录,我得到授权登录弹出。结果
我登录后,在弹出的说,这应该弹出自动关闭......结果
但在弹出不会关闭。结果
而在录音上载。
When I upload a recording, I get the authorization-login popup.
After I login, the popup says "This popup should auto close..."
But the popup doesn't close.
And the recording isn't uploaded.
我敢肯定SC.initialize有我的正确的clientID的,并从我的目录参照callback.html正确。结果
我缺少的东西吗?也许客户端秘密?
I'm positive SC.initialize has my correct "clientID" and is referencing "callback.html" correctly from my directory.
Am I missing something? maybe "client secret"?
SC.initialize({
client_id: "xxxxxxxxxxxxxxxxxxxxxx",
redirect_uri: "http://www.example.com/callback.html"
});
有一次(福禄克),而不是正常的弹出消息这应该关闭,该消息称502网关错误。但是我还没有能够重现这条消息。
One time (fluke) instead of the normal pop msg "This should close", the message said "502 Bad Gateway". But I havent been able to reproduce this msg.
推荐答案
的SoundCloud的样本code是坏了。
SoundCloud's sample code is broken.
这是从SoundCloud的 callback.html
This is from SoundCloud's callback.html
<body onload="window.opener.setTimeout(window.opener.SC.connectCallback, 1)">
这是我如何得到它的工作:
This is how I got it to work:
<body onload="window.setTimeout(window.opener.SC.connectCallback, 1)">
的SoundCloud的 connectCallback
使用 this.location
来收集OAuth访问令牌。如果设置 window.opener
超时,里面的 connectCallback
这个
将引用您的应用程序的窗口
和位置将是您的主页。而把它放在窗口
将绑定这个
回调弹出窗口和 this.location
将包含查询参数的访问令牌。
SoundCloud's connectCallback
uses this.location
to collect the OAuth access token. If you set the timeout on window.opener
, inside connectCallback
this
will refer to your app's window
and the location will be your main page. Whereas setting it on window
will bind this
to the callback popup window, and this.location
will contain the access token in the query arguments.
这篇关于的SoundCloud:callback.html弹出窗口不会关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!