Sha256: 2127053202273dd89d6f36fd6bc44ffe61ad71c4d3348c437b228b52208b3723

Contents?: true

Size: 898 Bytes

Versions: 1

Compression:

Stored size: 898 Bytes

Contents

# frozen_string_literal: true

require "omniauth-oauth2"

module OmniAuth
  module Strategies
    class EveOnlineSso < OmniAuth::Strategies::OAuth2
      option :name, "eve_online_sso"

      option :client_options,
        authorize_url: "/v2/oauth/authorize",
        token_url: "/v2/oauth/token",
        site: "https://login.eveonline.com/"

      uid { raw_info["CharacterID"] }

      info do
        {
          name: raw_info["CharacterName"],
          character_id: raw_info["CharacterID"],
          expires_on: raw_info["ExpiresOn"],
          scopes: raw_info["Scopes"],
          token_type: raw_info["TokenType"],
          character_owner_hash: raw_info["CharacterOwnerHash"]
        }
      end

      extra do
        {
          raw_info: raw_info
        }
      end

      def raw_info
        @raw_info ||= access_token.get("/oauth/verify").parsed
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omniauth-eve_online-sso-0.3.0 lib/omniauth/strategies/eve_online_sso.rb