Sha256: d5ac91b2db703256c5ac494fd93e0bc30b7156ab098eda0ae5d2080cb604b58c

Contents?: true

Size: 780 Bytes

Versions: 1

Compression:

Stored size: 780 Bytes

Contents

require 'omniauth-oauth2'

module OmniAuth
  module Strategies
    class BonnierOauth2 < OmniAuth::Strategies::OAuth2
      option :name, "bonnier_oauth2"
      option :client_options, {
        :site               => 'http://localhost:3000',
        :authorize_url      => '/api/oauth/authorize',
        :token_url          => '/api/oauth/token'
      }

      uid { raw_info["id"].to_s }

      info do
        {
          "email" => raw_info["email"],
          "username" => raw_info["username"],
          "profile_image" => raw_info["profile_image"]
        }
      end

      extra do
        {
          'raw_info' => raw_info
        }
      end

      def raw_info
        @raw_info ||= access_token.get('/api/v2/users/current.json').parsed
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omniauth-bonnier-oauth2-1.0.0 lib/omniauth/strategies/bonnier_oauth2.rb