Create an initializer making use of the OmniAuth middleware
Handling the Callback

Upon confirmation, you should be redirected back and get a routing error from Rails from /auth/yourprovider/callback. So let’s add a route!

If you start up the app again and go through the auth process, you should now see a hash that includes a whole lot of information about the user instead of a routing error.
We want users to be able to log in using one or many external services, so we’re actually going to separate users from authorizations. Let’s create simple Authorization and User models.

The User model doesn’t need to contain any information about authentication providers because we’ll model that through a relationship to the Authorization model.

The Authorization has both a provider (“facebook”) and a uid (the Facebook ID, ie: 123456789123456).
When a user signs in, look for existing Authorizations for that external account.
Create a user if no authorization is found.
Add an authorization to an existing user if the user is already logged in.
Handle user states
add lib/notification.rb