0

I'm using latest (1.0.1) version of Omniauth with rails 3.1.3. Right now, I'm using omniauth with 37signals strategy. I would like to pass custom argument ("state" parameter) depending on auth url (eg. http://localhost:3000/auth/37signals/5 should redirect to https://launchpad.37signals.com/authorization/new?(...)&state=5

I've tried to set (temporarily) fixed state, with something like

provider "37signals", "my_client_id", "my_secret", {state: "5"}

However, in my url there is (still) no state param. Any ideas why? Is it possible to set that param?

user1105595
  • 591
  • 2
  • 8
  • 20

3 Answers3

4

when creating the url you can just add state in the Query String and it will be available in the callback url as well.

user_omniauth_authorize_path(:facebook, :display => 'page', :state=>'123') %>

now the callback url will be

http://localhost:3000/consumers/auth/facebook/callback?state=123&code=ReallyLongCode#_=_

Now in the callback handler you can process the state

user566245
  • 4,011
  • 1
  • 30
  • 36
1

You have to use the :params options, as in

omniauth_authorize_path(:user, :facebook, var: 'value', var2: 'value2' )

and later in the callback you can access request.env['omniauth.params'] to get the hash! :)

(copied from this answer)

Community
  • 1
  • 1
Nimo
  • 7,984
  • 5
  • 39
  • 41
0

I think you can not to appending other params for the url. the server side just like the specify params.

maybe you need to take a look this one.

https://raw.github.com/tallgreentree/omniauth-37signals/e94a70a08c4535abb91338d8ef73593e143f1e5a/lib/omniauth/strategies/37signals.rb

Raecoo
  • 21
  • 1
  • 1
  • 4