Alex Rivera | Logout

Passing parameters through OmniAuth

Asked 2012-03-27T13:54:41.730
62

I need to pass some parameters to callback action. Judging from the source code, OmniAuth should add query string to callback URL but strangely it does not. When I open

/auth/facebook?from=partner

...and get redirected to Facebook, return_url is just

/auth/facebook/callback

...without any parameters.

Edit
Report

2 Answers

6

OmniAuth already has a built-in way to know where the user was, it's called "origin" as documented here:

https://github.com/intridea/omniauth/wiki/Saving-User-Location

answered 2012-08-10T23:11:24.937
-2

Use the 'state' Variable. Facebook allows the user to set a STATE variable.

Here is how I did it, I appended the AUTH URL with ?state=providername

http://localhost/users/auth/facebook?state=providername

This param is returned to me at Callback as params['providername']

I devised the solution from the original Omniauth Path Method

user_omniauth_authorize_path(:facebook, :display => 'page', :state=>'123') %>
answered 2012-10-16T09:54:34.250

Your Answer