{"action":"created","issue":{"url":"https://api.github.com/repos/binarylogic/authlogic/issues/136","labels_url":"https://api.github.com/repos/binarylogic/authlogic/issues/136/labels{/name}","comments_url":"https://api.github.com/repos/binarylogic/authlogic/issues/136/comments","events_url":"https://api.github.com/repos/binarylogic/authlogic/issues/136/events","html_url":"https://github.com/binarylogic/authlogic/issues/136","id":197192,"number":136,"title":"Problem with automatic login within custom subdomain after signup.","user":{"login":"sprout","id":177170,"avatar_url":"https://avatars.githubusercontent.com/u/177170?v=3","gravatar_id":"","url":"https://api.github.com/users/sprout","html_url":"https://github.com/sprout","followers_url":"https://api.github.com/users/sprout/followers","following_url":"https://api.github.com/users/sprout/following{/other_user}","gists_url":"https://api.github.com/users/sprout/gists{/gist_id}","starred_url":"https://api.github.com/users/sprout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sprout/subscriptions","organizations_url":"https://api.github.com/users/sprout/orgs","repos_url":"https://api.github.com/users/sprout/repos","events_url":"https://api.github.com/users/sprout/events{/privacy}","received_events_url":"https://api.github.com/users/sprout/received_events","type":"Organization","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2010-05-17T06:22:08Z","updated_at":"2015-04-30T17:36:54Z","closed_at":null,"body":"Hi,\r\n\r\nI am using rails 3.0.0.beta3 to implement authlogic and subdomain-fu. And, I have a problem with automatic login into subdomain after signup.\r\n\r\nThe scenario is : \r\nI have a signup form where an account and an admin user for that account are created simultaneously. Each time a new account is created, a separate subdomain is assigned to that account. \r\n\r\nWhen the form is submitted, I expect the user to be redirected to \r\n\"user-sub-domain\".\"app-domain\".com with the session for that sub-domain created automatically.\r\n\r\nCurrently, although the user is redirected to the corresponding subdomain, the session is not created. I think that the session is created only for the app-domain and when it is redirected to the subdomain, it doesn't find the session and thus, prompts the user to login again.\r\n\r\nHowever, second-time login works fine.\r\n\r\nI tried something like\r\nconfig.action_controller.session = { :domain => '.dummy.localhost' } in development.rb. But, it doesn't seem to work. It still shows up the login form.\r\n\r\nI would appreciate your help.\r\n\r\nThanks.\r\n"},"comment":{"url":"https://api.github.com/repos/binarylogic/authlogic/issues/comments/97892113","html_url":"https://github.com/binarylogic/authlogic/issues/136#issuecomment-97892113","issue_url":"https://api.github.com/repos/binarylogic/authlogic/issues/136","id":97892113,"user":{"login":"sapient","id":40472,"avatar_url":"https://avatars.githubusercontent.com/u/40472?v=3","gravatar_id":"","url":"https://api.github.com/users/sapient","html_url":"https://github.com/sapient","followers_url":"https://api.github.com/users/sapient/followers","following_url":"https://api.github.com/users/sapient/following{/other_user}","gists_url":"https://api.github.com/users/sapient/gists{/gist_id}","starred_url":"https://api.github.com/users/sapient/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sapient/subscriptions","organizations_url":"https://api.github.com/users/sapient/orgs","repos_url":"https://api.github.com/users/sapient/repos","events_url":"https://api.github.com/users/sapient/events{/privacy}","received_events_url":"https://api.github.com/users/sapient/received_events","type":"User","site_admin":false},"created_at":"2015-04-30T17:36:54Z","updated_at":"2015-04-30T17:36:54Z","body":"@tiegz You are right, its not specific to Authlogic at all, over the past few days I tried Sorcery and Devise as well, but this was the only topic which kind of closely matched my problem.\r\n\r\nI actually solved the problem earlier and typed out a whole response here in case anyone else every arrived here like I did, I thought I had submitted the comment, but apparently not.\r\n\r\nMy problem _was_ keeping authenticated across multiple subdomains, though I didnt really know that until I solved it. \r\n\r\nPost login details to one.app.dev, in the session controller, redirect to two.app.dev. Arrive at root on two.app.dev, buuuuut, still getting the root action for logged out people rendered - wierd. Log in *again*, and it works. Reverse the situation for logging out. It was very confusing.\r\n\r\nI eventually figured I had to add this domain thing to my session store\r\n```ruby\r\nRails.application.config.session_store :cookie_store, {\r\n  key: '_my_secret_key',\r\n  domain: '.mydomain.com'\r\n}\r\n```\r\nBut then I started getting an InvalidAuthenticityToken exception when I logged in. I had also been using constraints on the root route (Checking for the authlogic session variables), and that actually just added to the confusion. In the end the solution was to _delete my cookies_ (yes, **2 days** to figure this out). Some of them had the subdomain specific domain set and were messing with my sessions. \r\n\r\nAll fixed now though... Thanks!\r\n\r\nThough if I DID want a session per subdomain, how would you do it?"}}