Re: [Rails] issue in delete a cookie ( cannot 'eat' it ..)
It's not useful in my case , as I am using FB & Google authentification, the callback can be set only to the main domain
using the :state parameter I can redirect to the calling subdomain on FB/Google callback
but before the redirect I need to delete the previous session/cookies ( user may have been logged in an another subdomain or root domain)
setting :domain => :all , means that the cookies :host is/should_be '.example.com'
and I should be able to delete it : ( as per Rails API)
cookies.delete(:login, :host => '.example.com') but it's not working
I am going to test another way : expiring the cookie,...
def remove_all_cookies(domain=nil)
unless domain.nil?
cookies.to_hash.each_pair { |k, v| cookies[k.to_sym] = { :value => '', :path => '/', :domain => domain, :expire => 1.day.ago } }
end
end
Le mardi 13 novembre 2012 05:24:02 UTC+1, Greg Donald a écrit :
On Mon, Nov 12, 2012 at 11:47 AM, Erwin <yves_...@mac.com> wrote:
> I set my cookies at root domain level ( lvh.me in dev) , accessible from
> within each subdomain
> w session store initializer :
> Rails.application.config.session_store :active_record_store, :key =>
> '_tests_session', :domain => :all
Did you try setting your domain to the actual domain?
Rails.application.config.session_store :active_record_store, :key =>
'_tests_session', :domain => 'example.com'
> when a user login into a subdomain, I have
> cookies[:login]
> "{:user_id=>3, :subdomain_name=>\"coocoo\"}"
>
> when the user logout , I should delete this cookie,
> cookies.delete(:login, :host => Rails.configuration.host) if cookies[:login]
>
> but it doesn't delete it ... any clue ?
--
Greg Donald
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/L-aaEwIGO94J.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home