Sha256: aa95d04f58cbfce18a898df1edac229769515cb50ec6257a77edf7493697411e

Contents?: true

Size: 927 Bytes

Versions: 1

Compression:

Stored size: 927 Bytes

Contents

require 'omniauth/strategies/oauth2'

module OmniAuth
  module Strategies
    class ToodledoOauth2 < OmniAuth::Strategies::OAuth2

      option :name, 'toodledo_oauth2'

      option :client_options, {
               site: "https://api.toodledo.com/",
               authorize_url: "https://api.toodledo.com/3/account/authorize.php",
               token_url: "https://api.toodledo.com/3/account/token.php"
             }

      uid { raw_info["id"] }

      info do
        # raw_info.merge(token: access_token.token)
        {
          name: raw_info['alias'],
          email: raw_info['email']
        }
      end

      extra do
        { raw_info: raw_info }
      end
            
      def raw_info
        @raw_info ||= access_token.get('https://api.toodledo.com/3/account/get.php').parsed
      end

      def request_phase
        super
      end

      def callback_phase
        super
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omniauth-toodledo-oauth2-0.1.0 lib/omniauth/strategies/toodledo_oauth2.rb