All threads / Sharing Cookies with Subdomains in Rails Discussion

Ask A Question

Notifications

You’re not receiving notifications from this thread.

Sharing Cookies with Subdomains in Rails Discussion

Would it be possible for you to add subtitles in Portuguese or English? I am Brazilian, I can understand English subtitles. If you can in English it helps a lot.

Reply

Is there a strategy for sharing a login session between two different domains?

That's what we covered in this episode?

As I understand it, the episode covered sharing credentials between subdomains of the same domain. For example, foo.example.com & bar.example.com

Is there a way of sharing credentials between foo.com and bar.com ?

No. Cookies are bound to the same TLD.

Reply

Would this work for authenticating from non Rails app on a subdomain? For example if we have a Rails app hosted at foo.com, and then a Next.js app on bar.foo.com, could the Rails app authenticate API requests coming from bar.foo.com using the session cookie?

Yep! Just make sure the cookie gets included in the request and that's it. 👍

Reply
Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 51,723+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2021 GoRails, LLC. All rights reserved.