-
-
Notifications
You must be signed in to change notification settings - Fork 983
Dynamic Providers
Matthew Schulkind edited this page Jul 17, 2013
·
5 revisions
If you wish to dynamically set up a provider, the proper way as of 1.0 is to use the setup phase. The setup phase is a Rack endpoint that is called but not rendered to the user before both the request and callback phases of the OmniAuth lifecycle. For instance, if I wanted to dynamically set the :foo
option on the strategy based on the session, I could do something like this:
use OmniAuth::Builder do
provider :example, :setup => lambda{|env| env['omniauth.strategy'].options[:foo] = env['rack.session']['foo'] }
end
If you are looking to simply replace the default OmniAuth forms with something more friendly to your particular application, you will be able to simply pass a :form
option with a Rack endpoint that will render in place of the OmniAuth default form. For example, in a Rails application you might do something like this:
use OmniAuth::Builder do
provider :example, :form => SessionsController.action(:new)
end
User Docs
- List of Strategies
- Frequently Asked Questions
- Help Topics
- External Resources
- Upgrading to 1.0
- Upgrading to 2.0
- Auth Hash Schema
Strategy Developers
Project Resources