LoginRadius

Rails gem which enables token authentication against loginradius.com

What is LoginRadius? (from loginradius.com)

To give your business a boost on the web, we at LoginRadius came up with a different approach to the login process. Using LoginRadius, you can easily integrate social login on your website and allow users to register with their existing accounts on Facebook, Google, Yahoo, Twitter, and over 20 more providers. Eliminating the annoying registration process will not only attract more traffic to your website but also boost your user base. All ID providers are integrated to your website via LoginRadius, users can connect to ID providers through the channel provided by LoginRadius without ever navigating away from your website.

Its simple to use

Please review the loginradius website to build an understanding of how to:

  1. register for an account

  2. integrate the signin form with your markup

Once you have integrated the signin form you will need to be able to process “callbacks” from the loginradius system. The callback happens after a user authenticates, via their chosen method, whereupon an authentication token is passed to your application as a parameter over a route of your specification. e.g.

Perhaps you might specify “myapp.mydomain.com/callback” as the method to contact your application. In order to service the callback you will need to:

  1. create a controller action and an appropriate entry in your config/routes.rb file

  2. in the controller action validate the callback is authentic

The purpose of the loginradius gem is to support the validation of the callback through a simple helper class, LoginRadiusSession.

Install it as a Gem

loginradius is available as a Ruby gem.

$ [sudo] gem install loginradius

The loginradius source is available at GitHub:

$ git clone git://github.com/sicruse/loginradius.git

Example usage

class SessionsController < ApplicationController
  protect_from_forgery :except => :callback

  def callback
    logger.debug "received LoginRadius callback!"

    # Initialize the LoginRadius session - API key 
    loginradius = LoginRadius::LoginRadiusSession.new "INSERT YOUR KEY HERE"

    # Authenticate the LoginRadius session vs. the token being passed to our app
    if loginradius.is_authentic_token? params[:token], params[:lrid]
      logger.debug "successfully authenticated LoginRadius"
      logger.debug loginradius.data

      # Now need to create user record or login user
      ...

LICENSE:

(The MIT License)

Copyright © Si Cruse, mindcultivator.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.