# Restful\_authentication log in from controller

**URL:** <https://www.ruby-forum.com/t/restful-authentication-log-in-from-controller/109555>\
**Category:** Rails\
**Created:** [July 16, 2007, 9:06pm UTC](https://www.ruby-forum.com/t/restful-authentication-log-in-from-controller/109555 "2007-07-16T21:06:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PatRoy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/3ec8ea/32.png) [@PatRoy](https://www.ruby-forum.com/u/PatRoy)\
**Post date:** [July 16, 2007, 9:06pm UTC](https://www.ruby-forum.com/t/restful-authentication-log-in-from-controller/109555/1 "2007-07-16T21:06:58Z")

</div>

Here’s my problem. I’m using restful\_authentication and recently added  
subdomain logins e.g. ([myaccount.domain.com](http://myaccount.domain.com)) I have a page to create  
an account and an admin account in the same page. Both the account and  
admin are created. I can call self.current\_user =  
User.authenticate … with no problem, I will get back the user. When  
it comes to redirecting to another action I have a  
before\_filter :login\_required. This is where it screws up. In that  
function there’s a get\_auth\_data… this function returns nil for a  
username and password. Any ideas? This functions correctly if I login  
from a form calling the create action in my session controller.

Help?

---

<div class="post-metadata">

**Author:** ![PatRoy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/3ec8ea/32.png) [@PatRoy](https://www.ruby-forum.com/u/PatRoy)\
**Post date:** [July 16, 2007, 9:15pm UTC](https://www.ruby-forum.com/t/restful-authentication-log-in-from-controller/109555/2 "2007-07-16T21:15:59Z")

</div>

Seems like the session[:user] gets cleared right after I redirect ?
