Auth with jQuery

3 views
Skip to first unread message

ricardoe

unread,
Aug 27, 2008, 3:38:35 PM8/27/08
to SlimTimer Developer Forum
Hello, I'm trying to do some jQuery magic and get my access token.
I'm using this:
jQuery.ajax({
type:'POST',
url: 'http://www.slimtimer.com/users/token',
dataType: 'xml',
data: {
request : {
api_key: apikey,
user: { email: user_email , password: user_password }
}
},
error: function(response){

alert(response.responseXML.documentElement.childNodes[1].textContent);
},
success: function(response){
alert(response.);
}
});

But I'm getting just a 500 server error: "<?xml version="1.0"
encoding="UTF-8"?>\n<errors>\n <error>Authentication failed</error>\n</
errors>\n"

I'm sure my credentials and api key is correct.

:) Thanks for the help :)

PS. Slimtimer is great!

igitur

unread,
Sep 17, 2008, 7:43:25 PM9/17/08
to SlimTimer Developer Forum
Like so:

jQuery.ajax({
type: 'POST',
url: 'http://www.slimtimer.com/users/token',
dataType: 'json',
data: {
api_key: apikey,
'user[email]': user_email,
'user[password]': user_password
},
error: function(response){
var data; eval('data=' + response.responseText);
alert(data.error);

},
success: function(response){

alert(response.access_token);
}

});

Reply all
Reply to author
Forward
0 new messages