Authenticating with different api keys for each request

49 views
Skip to first unread message

Joe Van Dyk

unread,
Nov 30, 2011, 6:34:00 PM11/30/11
to omniauth
We are hosting different domains in the same Rails application
instance. We have http://www.domain1.com, http://www.domain2.com,
etc. Each domain would authenticate against a different facebook or
twitter application.

The default omniauth pattern is to specify the api keys once in the
application:

config.middleware.use OmniAuth::Builder do
provider :facebook, 'blah', 'something'
end

We would need the keys to change on each incoming request, as each
request could service a different site/domain.

How would you do this? I was thinking that we'd need a Rack
middleware that loads before the omniauth ones. That Rack middleware
would load the correct authentication keys and send that the to the
omniauth middlewares.

Is that possible? Has anyone done something like this before?

Thanks,
Joe

Mike Petersen

unread,
Apr 25, 2014, 3:48:56 PM4/25/14
to omni...@googlegroups.com
Hi Joe,
did you find a good solution?

Regards
Mike

Joe Van Dyk

unread,
Apr 25, 2014, 3:52:54 PM4/25/14
to omni...@googlegroups.com
This was a long time ago, but I think you could pass a block into the configuration method. The block receives the rack request object, so you can inspect that and have the block return the correct config data. 
--
You received this message because you are subscribed to a topic in the Google Groups "omniauth" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/omniauth/MOlv4IHuMb8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to omniauth+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages