My RhoConnect client is written in javascript. I would like to add a custom route which does not require authentication (logged into RhoConnect). I know this is possible in Ruby by specifying:
get '/my_custom_route', :login_required => false
Is the same available when writing the method in javascript? Here's my code:
app.post('/my_custom_route', {}, function(req, resp){
// should get here without being logged into RhoConnect
console.log('req', req);
});
When I try the above code in RhoConnect, I get this http response:
body: "Not authenticated"
error_code: "9"
headers: Object
http_error: "401"
status: "error"
Thanks,
Mark
2 Replies
Mark,
You will need to add a couple more arguments in order to make this work. I just double checked the following code, and it works.
app.post('/my_custom_route2', {'login_required':false, "source_required":false, "client_required":false}, function (req, resp){
resp.send(true);
});
Your custom route in JS doesn't specify :login_required => false. Please use this:
app.post('/my_custom_route', {'login_required':false}, function(req, resp){
// should get here without being logged into RhoConnect
console.log('req', req);
});
Max.