I'm going to get track on my site from soundcloud. I'm working according to official tutorial. Well, I created app in soundcloud, got cliend_id and client secret. Also I've created callback.php and showed it as redirect_uri in app settings of soundcloud. Here it's content.
<?php
require_once './Services/Soundcloud.php';
// my_client_id and my_client_secret are my but I'm not sure what should be instead of http://example.com/callback so I just left it here.
$client = new Services_Soundcloud(
'my_client_id', 'my_client_secret', 'http://example.com/callback');
var_dump($client);
echo'<!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.opener.setTimeout(window.opener.SC.connectCallback, 1)">
<b style="width: 100%; text-align: center;">This popup should automatically close in a few seconds</b>
</body>
</html>';
// redirect user to authorize URL
//header("Location: " . $client->getAuthorizeUrl());
?>
Also here is my main .js script fragment.
$(document).ready(function() {
SC.initialize({
client_id: 'my_client_id',
redirect_uri: 'http://sscopin.temp.swtest.ru/radio%20for%20upload/Derpman/callback.php'
});
// initiate auth popup
SC.connect(function() {
SC.get('/me', function(me) {
alert('Hello, ' + me.username);
});
});
});
So I used my callback.php as redirect_uri when initializing SC
So I get some strange results. I got popud window with soundcloud login. And when I enter my login/password I get my page. I can watch dump of $client and message but if I uncomment string:
header("Location: " . $client->getAuthorizeUrl());
I get cyclic forwarding error. So what's wrong? What should I use as redicrect uri in javascript, php and soundcloud app settings? That's not clear at all for me.