What is Omniauth?
The web application landscape has changed drastically in the past few years. Most users login in to dozens, sometimes hundreds of services each day; sites are no longer silos unto themselves and cannot reasonably expect users to create a unique login and password for each service. This is where OmniAuth comes in.
OmniAuth is a library that standardizes multi-provider authentication for web applications. It was created to be powerful, secure, and flexible. Any developer can create strategies for OmniAuth that can authenticate users via disparate systems. OmniAuth strategies have been created for everything from Facebook to LDAP.
Who’s Using OmniAuth?
Hundreds of people are leveraging the advantages of super simple, secure authentication with OmniAuth in their applications. From event registration sites to online wholesale distribution stores, to online trading platforms and beyond, developers are relying on OmniAuth to streamline user authentication in their systems.
To use OmniAuth in a project with a Gemfile, just add each of the strategies you want to use individually:
Now you can use the
OmniAuth::Builder Rack middleware to build
up your list of OmniAuth strategies for use in your application:
use OmniAuth::Builder do
provider:github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET']
provider:openid, :store => OpenID::Store::Filesystem.new('/tmp')end
By default, OmniAuth will return auth information to the path
/auth/:provider/callback inside the Rack environment. In Sinatra,
for example, a callback might look something like this:
# Support both GET and POST for callbacks
%w(get post).each do |method|
send(method, "/auth/:provider/callback") do
env['omniauth.auth'] # => OmniAuth::AuthHash
For additional documentation, you should see the OmniAuth wiki.
Want an idea of the different providers OmniAuth gives you the ability to authenticate through? Try out any of the providers in the list below, each one is a live example of authenticating with OmniAuth!
Foursquare by arunagw
Geoloqi by kyledrake
GitHub by intridea
Identity by intridea
LinkedIn by skorks
PicPlz by arunagw
OpenID by intridea
Twitter by arunagw
- Official OmniAuth Wiki - Official OmniAuth Wiki
- The official Github OmniAuth Strategy - The official Github OmniAuth Strategy
- README Doc - Blog post announcing OmniAuth 1.0
- Announcing OmniAuth 1.0 - Blog post announcing OmniAuth 1.0
- Sinatra Example - Example of an OmniAuth implementation in Sinatra
- OmniAuth Identity - A simple login and password strategy for OmniAuth