require 'omniauth-oauth2'

module OmniAuth
  module Strategies
    class Doorkeeper < OmniAuth::Strategies::OAuth2
      # change the class name and the :name option to match your application name
      option :name, :adstage

      option :client_options, {
        :site => (ENV['ADSTAGE_ENDPOINT'] || "https://www.adstage.io"),
        :authorize_url => "/oauth/authorize"
      }

      uid { raw_info["id"] }

      info do
        {
          :email => raw_info["email"]
          # and anything else you want to return to your API consumers
        }
      end

      def raw_info
        @raw_info ||= access_token.get('/api/me').parsed
      end
    end
  end
end

require 'omniauth-oauth2'

module OmniAuth
  module Strategies
    class Adstage < OmniAuth::Strategies::OAuth2
      # change the class name and the :name option to match your application name
      option :name, :adstage

      option :client_options, {
        :site => (ENV['ADSTAGE_ENDPOINT'] || "https://www.adstage.io"),
        :authorize_url => "/oauth/authorize"
      }

      uid { raw_info["id"] }

      info do
        {
          :email => raw_info["email"],
          :admin => raw_info["admin"]
          # and anything else you want to return to your API consumers
        }
      end

      def raw_info
        @raw_info ||= access_token.get('/api/me').parsed
      end
    end
  end
end

Set admin attribute if we get it from the server.
Set admin attribute if we get it from the server.
