Why?

Even if you've already set up authentication, DailyCred can be extremely helpful as a proxy for other authentication providers. For example:

  • Not all OAuth providers allow you to pass state, and none of them allow you to pass additional parameters like referrer.
  • You get instant access to a comprehensive dashboard with user behavior analytics.
  • Implement a single consistent omniauth provider by sending your user to connect_path(identity_provider: "{provider here}")

Installation

Add dailycred to your gemfile and run bundle

gem 'dailycred'

run rails g dailycred --skip-bootstrap

Add your dailycred keys to config/initializers/omniauth.rb.

Then just follow the steps for integration omniauth into your application. You don't need to add anything to your initializer to add dailycred as an omniauth provider, that's already done for you.

In your callback, request.env['omniauth.auth'] will look something like the following:

{
   "provider" => "dailycred",
        "uid" => "userid-xx-yy",
       "info" => {
             "token" => "token-xxyy-token",
          "provider" => "dailycred",
               "uid" => "userid-xx-yy",
               "ban" => false,
         "user_type" => "CONVERTED",
        "identities" => {},
           "display" => "test@test.com",
            "emails" => {},
           "picture" => "https://www.dailycred.com/user/pic?user_id=userid-xx-yy&size=50",
        "updated_at" => 1366670682849,
           "created" => Mon, 15 Apr 2013 18:20:28 +0000,
             "email" => "test@test.com",
    "last_logged_in" => 1366670682848,
          "verified" => false,
             "guest" => false,
        "attributes" => {},
     "access_tokens" => {
        "dailycred" => "token-xxyy-token"
    },
      "access_token" => "token-xxyy-token"
},
"credentials" => {
      "token" => "token-xxyy-token",
    "expires" => false
},
      "extra" => {}
}

Done

That's it! You should start seeing new activity immediately on your dashboard. Let us know what you think, and we always appreciate feedback and suggestions!