0.0
No commit activity in last 3 years
No release in over 3 years
Abstract XAuth strategy for OmniAuth
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0
~> 1.0
 Project Readme

Dependency Status

Build Status

OmniAuth XAuth

OmniAuth XAuth strategy for use in OmniAuth 1.0 strategy development.

This gem contains a generic XAuth strategy for OmniAuth. It is meant to serve as a building block strategy for other strategies and not to be used independently (since it has no inherent way to gather uid and user info).

The XAuth form is rendered as an OmniAuth Form and can be styled as such.

Creating an XAuth Strategy

To create an OmniAuth XAuth strategy using this gem, you can simply subclass it and add a few extra methods like so:

require 'omniauth-xauth'

module OmniAuth
  module Strategies
    class SomeSite < OmniAuth::Strategies::XAuth
      option :client_options, {
        :site               => 'http://www.service.com/',
        :access_token_url   => 'https://www.service.com/oauth/access_token'
      }
      option :xauth_options, { :title => 'XAuth Login Form Header'}


      # This is where you pass the options you would pass when
      # initializing your consumer from the OAuth gem.


      uid { raw_info['uid'] }
      info do
        {
          :name => raw_info['name'],
          :email => raw_info['email']
        }
      end

      extra do
        {
          'raw_info' => raw_info
        }
      end

      def raw_info
        @raw_info ||= MultiJson.decode(access_token.get('/me.json').body)
      end
    end
  end
end