Sunday, 15 April 2012

api - how to make rails-issued cookie work cross subdomain -



api - how to make rails-issued cookie work cross subdomain -

i having situation when trying create rails application backend core of apis. using 'devise' authenticate users, putting session cookie. far perfect. , take in consideration building on "api.mydomain.com"

now, have javascript application running on "mydomain.com" ajax calls api on subdomain. need have rails-issued cookie valid , go on headers when create api calls... doesn't.

i tried every single solution found on google, looks putting

api::application.config.session_store :cookie_store, key: '_api_session', :domain => ".mydomain.com"

into config/initializers/session_store.rb default answer. didn't work me. found other recommendation on google shoudl set in environment file. didn't work either me.

help appreciated.

please note: running rails 3.2.11 should matter.

try using :domain => :all option.

source: railsapps tutorial on subdomains (search "optional: allow sessions shared across subdomains")

ruby-on-rails api authentication cookies

No comments:

Post a Comment