[英]Deezer Javascript SDK on localhost
For developing I would like to use the Deezer Javascript SDK on localhost.对于开发,我想在本地主机上使用 Deezer Javascript SDK。 I set the application domain on
localhost:8000
, but it didn't work.我在
localhost:8000
上设置了应用程序域,但是没有用。 My HTML file is on localhost:8000
:我的 HTML 文件在
localhost:8000
:
<!DOCTYPE html>
<html>
<head>
<title>Deezer to Spotify</title>
</head>
<body>
<div id="dz-root"></div>
<script src="http://cdn-files.deezer.com/js/min/dz.js"></script>
<script src="DeezerToSpotifySwitcher.js" charset="utf-8"></script>
</body>
</html>
My javascript file:我的 javascript 文件:
DZ.init({
appId: '147671',
channelUrl: 'http://localhost:8000/DeezerToSpotifySwitcher.html'
});
DZ.login(function (response) {
if (response.authResponse) {
DZ.api('/user/me', function (response) {
alert('Good to see you, ' + response.name + '.');
});
} else {
alert('User cancelled login or did not fully authorize.');
}
}, { perms: 'basic_access,email' });
What application domain do I have to set?我必须设置什么应用程序域? Did I miss something else?
我错过了什么吗?
You can try with : channelUrl: ' http://yourAppDomain.com/channel.php '您可以尝试使用: channelUrl: ' http://yourAppDomain.com/channel.php '
or或者
channelUrl: ' http://yourAppDomain.com/channel.html频道网址:' http://yourAppDomain.com/channel.html
似乎它只能在没有明确端口定义的情况下工作 - 所以只需重新配置您的本地服务器以在端口 80 上运行。
I had the same issue, using domain deezer-dl.local:8888 .我有同样的问题,使用域deezer-dl.local:8888 。
On https://connect.deezer.com/oauth/auth.php , it was displaying:在https://connect.deezer.com/oauth/auth.php 上,它显示:
You must enter a valid redirect uri
I solved the problem by fixing the Application Domain in Deezer applications' preferences to deezer-dl.local (without port) and using the standard 80 port for my application...我通过将 Deezer 应用程序首选项中的应用程序域修复为deezer-dl.local (无端口)并为我的应用程序使用标准 80 端口解决了该问题...
Try 127.0.0.1:8000
instead of localhost:8000
.尝试
127.0.0.1:8000
而不是localhost:8000
。 And don't forget to add it to permitted hosts as 127.0.0.0.1:8000
.并且不要忘记将其作为
127.0.0.0.1:8000
添加到允许的主机中。 And you don't have to use 80 port in this case.在这种情况下,您不必使用 80 端口。
Worked perfectly for me.非常适合我。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.