Sha256: 610f0ba5c14727bf8bca1b892b42868185a71e747f5715baef55e91b590d74c7

Contents?: true

Size: 646 Bytes

Versions: 15

Compression:

Stored size: 646 Bytes

Contents

require 'omniauth'
require 'omniauth-oauth2'

module OmniAuth
  module Strategies
    class Openstax < OAuth2
      option :name, "openstax"

      option :client_options, {
        site: "http://accounts.openstax.org",
        authorize_url: "/oauth/authorize"
      }

      uid { raw_info[:uuid] }

      info do
        # Changed to conform to the omniauth schema
        raw_info.slice(:name, :first_name, :last_name, :title).merge(nickname: raw_info[:username])
      end

      extra { { raw_info: raw_info } }

      def raw_info
        @raw_info ||= access_token.get('/api/user.json').parsed.symbolize_keys
      end

    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
openstax_accounts-9.7.0 lib/omniauth/strategies/openstax.rb
openstax_accounts-9.6.1 lib/omniauth/strategies/openstax.rb
openstax_accounts-9.6.0 lib/omniauth/strategies/openstax.rb
openstax_accounts-9.5.1 lib/omniauth/strategies/openstax.rb
openstax_accounts-9.5.0 lib/omniauth/strategies/openstax.rb
openstax_accounts-9.4.0 lib/omniauth/strategies/openstax.rb
openstax_accounts-9.3.0 lib/omniauth/strategies/openstax.rb
openstax_accounts-9.0.5 lib/omniauth/strategies/openstax.rb
openstax_accounts-9.0.4 lib/omniauth/strategies/openstax.rb
openstax_accounts-9.2.0 lib/omniauth/strategies/openstax.rb
openstax_accounts-9.0.3 lib/omniauth/strategies/openstax.rb
openstax_accounts-9.1.0 lib/omniauth/strategies/openstax.rb
openstax_accounts-9.0.2 lib/omniauth/strategies/openstax.rb
openstax_accounts-9.0.1 lib/omniauth/strategies/openstax.rb
openstax_accounts-9.0.0 lib/omniauth/strategies/openstax.rb