I am currenty trying to write my first ever stack exchange application and was using the SE Jaavascript SDK v 2.0 for this purpose.
I am stuck on the point of authenticating the user. I followed the steps mentioned here
I am able to complete the call to SE.init successfully, However, when I call SE.authenticate, I get a login window where-in I login using my StackExchange account. At this point, I get an error that says Unexpected domain on proxy URL.
I would like to point out that I am using a cloud-based IDE at nitrous.io and hence I can test-run this application within the preview URL provided by them. In my case, I access the preview URL as follows :
http://cybertron-nodejs-11139.apse1.actionbox.io:3000/files/index.html
Here is my code snippet for the JS file that contains all the initialization and authentication logic:
$(document).ready(function() {
SE.init({clientId: 1880,
key: '396D79cbzmt3w*Pf)E7AUw((',
// Used for cross domain communication, it will be validated
channelUrl: 'http://cybertron-nodejs-11139.apse1.actionbox.io:3000/files/blank.html',
// Called when all initialization is finished
complete: function(data) {
console.log(data)
$('#login-button')
.removeAttr('disabled')
.text('Run Example With Version '+data.version);
}
});
$("#login-button").click(function() {
SE.authenticate({
success: function(data) {
alert(
'User Authorized with account id = ' +
data.networkUsers[0].account_id + ', got access token = ' +
data.accessToken
);
},
error: function(data) {
alert('An error occurred:\n' + data.errorName + '\n' + data.errorMessage);
},
networkUsers: true
});
});