0

I use omniauth for Facebook Authentification in my app. All works great. Now I try to implement a callback to a dynamic page which is the ID of an article.

The URL follows the pattern myapp.com/ads/:id/ On this page I use the auth gateway to /auth/facebook The callback should come back exactly to this page (e.g. /ads/4711/).

I tried to accomplish this in routes:

match "/auth/facebook/callback" => "/ads/:id/"

which is obv not valid. Also tried to work out this solution OmniAuth dynamic callback url to authenticate particular objects instead of current_user with no success.

Any help is appreciated.

Community
  • 1
  • 1
DonMB
  • 2,550
  • 3
  • 28
  • 59
  • 1
    I don't understand what are you trying to schieve, could you make it clear please? – Mike Szyndel Jun 20 '13 at 10:28
  • What if you receive callback as usual and then redirect? – Yuri Golobokov Jun 20 '13 at 11:06
  • Ok to make it more clear: Let's say we are on a dynamic page /ads/4711 - the ID gets fetched via params['id'] and releases some content on that page based on the ID (that's why it is dynamic). Now a user Facebook auth himself - sees the Facebook auth page and after successfully logging in, he should get redirected to the very same page he came from. (in this case: /ads/4711) - I need to somehow pass the ID to the Facebook auth page and get it back after the call back (if this is the solution) but I don't know how. – DonMB Jun 20 '13 at 11:16

1 Answers1

0

Found the solution via Devise + Omniauth - How to pass extra parameters along?

I can easily pass the ID as a param to the auth page and get it back via request.env['omniauth.params']

Community
  • 1
  • 1
DonMB
  • 2,550
  • 3
  • 28
  • 59