omniauth-linear 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +2 -2
- data/lib/omniauth/strategies/linear.rb +13 -7
- data/lib/omniauth-linear/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b5959c5984ffabb34eaa54921f2a7654322cb1e823762ca435729d363caf9fc
|
4
|
+
data.tar.gz: afee27f2a374d79f0ed615dc19a81d63aec829cc99a5edb5d79953d677538e02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c9320de46fc3d6c084a5de782dbf947349835565c2f996bec6476e91993b73416c42e7377de0747998c2730fcdbea90d028751335a858cae67b35c721c9fa6c
|
7
|
+
data.tar.gz: c476481613c76ec25e000bfd44ef57362475685b0ddede8d1156347b48cf18afea02e60f5c8c1a4ca04daeec9cb4c955b620ddb76736c0bbfc9f032021d4c74f
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -16,7 +16,7 @@ gem 'omniauth-linear'
|
|
16
16
|
|
17
17
|
```ruby
|
18
18
|
use OmniAuth::Builder do
|
19
|
-
provider :linear, ENV['LINEARAPP_CLIENT_ID'], ENV['LINEARAPP_CLIENT_SECRET']
|
19
|
+
provider :linear, ENV['LINEARAPP_CLIENT_ID'], ENV['LINEARAPP_CLIENT_SECRET'], { scope: 'read,issues:create' }
|
20
20
|
end
|
21
21
|
```
|
22
22
|
|
@@ -26,7 +26,7 @@ In `config/initializers/linear.rb`
|
|
26
26
|
|
27
27
|
```ruby
|
28
28
|
Rails.application.config.middleware.use OmniAuth::Builder do
|
29
|
-
provider :linear, ENV['LINEARAPP_CLIENT_ID'], ENV['LINEARAPP_CLIENT_SECRET']
|
29
|
+
provider :linear, ENV['LINEARAPP_CLIENT_ID'], ENV['LINEARAPP_CLIENT_SECRET'], { scope: 'read,issues:create' }
|
30
30
|
end
|
31
31
|
```
|
32
32
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'omniauth-oauth2'
|
2
|
-
require
|
2
|
+
require "graphql/client"
|
3
|
+
require "graphql/client/http"
|
3
4
|
|
4
5
|
module OmniAuth
|
5
6
|
module Strategies
|
@@ -41,12 +42,16 @@ module OmniAuth
|
|
41
42
|
|
42
43
|
def me
|
43
44
|
@me ||= begin
|
44
|
-
|
45
|
-
headers
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
http = GraphQL::Client::HTTP.new(options.client_options.site) do |obj|
|
46
|
+
def headers(context)
|
47
|
+
{"Authorization" => "Bearer #{context[:token]}"}
|
48
|
+
end
|
49
|
+
end
|
50
|
+
schema = GraphQL::Client.load_schema(http)
|
51
|
+
client = GraphQL::Client.new(schema: schema, execute: http)
|
52
|
+
client.allow_dynamic_queries = true
|
53
|
+
|
54
|
+
gql = client.parse <<~GRAPHQL
|
50
55
|
query {
|
51
56
|
viewer {
|
52
57
|
id
|
@@ -55,6 +60,7 @@ module OmniAuth
|
|
55
60
|
}
|
56
61
|
}
|
57
62
|
GRAPHQL
|
63
|
+
response = client.query(gql, context: {token: access_token.token})
|
58
64
|
response.data
|
59
65
|
end
|
60
66
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-linear
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Quentin Rousseau
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
154
|
- !ruby/object:Gem::Version
|
155
155
|
version: '0'
|
156
156
|
requirements: []
|
157
|
-
rubygems_version: 3.0.3
|
157
|
+
rubygems_version: 3.0.3.1
|
158
158
|
signing_key:
|
159
159
|
specification_version: 4
|
160
160
|
summary: Official OmniAuth strategy for Linear.
|