Can I use everyauth with AJAX?

269 views
Skip to first unread message

Michael Spiegle

unread,
Mar 10, 2012, 11:20:19 PM3/10/12
to everyauth
I'm working on a project where a UI engineer is building out a webapp
in javascript, and my job is to provide backend services via nodejs.
I've finally got facebook and password auth working properly, but I
realized there could be issues doing the password auth with AJAX. My
UI engineer wants to just post the email/password to /login/, and get
a JSON response back with either a 'success' or 'fail', but it seems
like everyauth is designed to redirect the user instead. Is there any
way to stop the redirect from happening so I can just use a 200-OK
every time with the result in a JSON blob?

Brian

unread,
Mar 11, 2012, 1:10:18 AM3/11/12
to ever...@googlegroups.com
Yes, just over-write the default `respondToLoginSucceed` and `respondToLoginFail` callbacks for `everyauth.password`. See this gist for example code: https://gist.github.com/2015238

--Brian

mspi...@nauticaltech.com

unread,
Mar 14, 2012, 2:49:07 AM3/14/12
to ever...@googlegroups.com
Perfect, thanks!
Reply all
Reply to author
Forward
0 new messages