redirecting back to original subdomain after facebook login?

453 views
Skip to first unread message

emiltin

unread,
Mar 12, 2011, 10:09:16 AM3/12/11
to Devise

hi,
i'm using devise 1.2.rc with the support for omniauth. i'm using this
for login via facebook.

my site uses subdomains. this causes two problems:

1.
i use user_omniauth_authorize_path(:facebook) to place a 'login via
facebook' link on a page on a subdomain. this link will contain the
subdomain. when it's clicked, facebook barks, since the subdomain
doesn't match the domain for my facebook app.

as a workarond for this problem, i'm stripping the subdomain from the
login link.


2.
but stripping the subdomain from the login link means that after the
user logins on facebook, he/she is redirected back to my main domain,
instead of the subdomain where he/she clicked the original login
link.

how can i solve this frustrating problem?


thank you!

emil tin

José Valim

unread,
Mar 12, 2011, 10:11:34 AM3/12/11
to Devise
Store the subdomain you want to redirect to in the session and
redirect to it in the callback.

Sébastien Gruhier

unread,
Mar 12, 2011, 11:01:16 AM3/12/11
to plataforma...@googlegroups.com
if you use latest omniauth release read this https://github.com/intridea/omniauth/wiki/Saving-User-Location
Reply all
Reply to author
Forward
0 new messages