Class: OmniAuth::Strategies::Linear

Inherits:
OAuth2
  • Object
show all
Defined in:
lib/omniauth/strategies/linear.rb

Instance Method Summary collapse

Instance Method Details

#authorize_paramsObject



25
26
27
28
29
30
31
32
33
34
# File 'lib/omniauth/strategies/linear.rb', line 25

def authorize_params
  super.tap do |params|
    %w[client_options].each do |v|
      if request.params[v]
        params[v.to_sym] = request.params[v]
      end
    end
    params[:actor] = options[:actor]
  end
end

#callback_urlObject



75
76
77
# File 'lib/omniauth/strategies/linear.rb', line 75

def callback_url
  "#{full_host}#{callback_path}"
end

#meObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/omniauth/strategies/linear.rb', line 46

def me
  @me ||= begin
    http = GraphQL::Client::HTTP.new(options.client_options.site) do |obj|
      def headers(context)
        {"Authorization" => "Bearer #{context[:token]}"}
      end
    end
    schema = GraphQL::Client.load_schema(http)
    client = GraphQL::Client.new(schema: schema, execute: http)
    client.allow_dynamic_queries = true

    gql = client.parse "      query {\n        organization {\n          id\n          name\n        }\n        viewer {\n          id\n          name\n          email\n        }\n      }\n    GRAPHQL\n    response = client.query(gql, context: {token: access_token.token})\n    response.data.to_h\n  end\nend\n"

#raw_infoObject



42
43
44
# File 'lib/omniauth/strategies/linear.rb', line 42

def raw_info
  @raw_info ||= {}
end

#request_phaseObject



21
22
23
# File 'lib/omniauth/strategies/linear.rb', line 21

def request_phase
  super
end