javascriptlocalhostdeezer

Deezer Javascript SDK on localhost


For developing I would like to use the Deezer Javascript SDK on localhost. I set the application domain on localhost:8000, but it didn't work. My HTML file is on 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:

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?


Solution

  • I had the same issue, using domain deezer-dl.local:8888.

    On https://connect.deezer.com/oauth/auth.php, it was displaying:

      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...