omniauth-bolt 0.0.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef01fcc3c94ba30af520dd517366bfe075b6877cc27c58724e2325e7e6ac7915
4
- data.tar.gz: '080285b45ae56a4111d0ad2b7ff6f8915e6dbac3b4e9ee1dbb3d210202afb1d5'
3
+ metadata.gz: 8c04af3a73534c52b17d5aec1c415b9cd7fed4f48f0bc8a2998352b0f2caec7d
4
+ data.tar.gz: 5f4603ca5b9c1280781ae163bed7c0e4a45c1b3bdb11a13f099617261cbd41fd
5
5
  SHA512:
6
- metadata.gz: 3a1ce018932d2431c9f023b5d6c7c2f5db00f7257f97d583392288fc88ff858f931e7383dd23b2ce5087e6db4a2dcdd17efed2de1d21fdfb747dd5ad9c9b0e8b
7
- data.tar.gz: 646f8f4666b614019f9d963ba86cd79cd062b1608fb2a8db365479471e6653880e765dc570415b16917972b1f02b6fa9657b1431c1f6b7938d7bc96faee5d376
6
+ metadata.gz: 4dd087adebaf81428676f982bd2e6376e04578b5747d0e3ee5661639709e8b6da40d2dce44656b3fe6c4d32764be88a6add13e751affbb6696a15f71786dfbed
7
+ data.tar.gz: 58b2aafe0671c21b2a17e8823dec526d457f0319aa93c557ae40dcc4e94a92971d87e03ed4f17428a571d75283f17d9aa602eb1fd8bfe1d990ee3acec1529bc9
@@ -30,24 +30,22 @@ module OmniAuth
30
30
  }
31
31
  end
32
32
 
33
- def request_phase
34
- OmniAuth::Form.build(:title => options.title, :url => callback_path) do
35
- text_field 'Email', 'email'
36
- end.to_response
37
-
38
- session[:authorization_code] = request.params['authorization_code']
39
- session[:scope] = request.params['scope']
33
+ def query_string
34
+ authorization_code = request.params['code'] || request.params['authorization_code']
35
+ "?authorization_code=#{authorization_code}&scope=#{request.params['scope']}&state=#{request.params['state']}"
36
+ end
40
37
 
38
+ def request_phase
41
39
  redirect callback_url
42
40
  end
43
41
 
44
42
  def callback_phase
45
43
  payload = {
46
44
  grant_type: 'authorization_code',
47
- code: session['authorization_code'],
45
+ code: request.params['authorization_code'],
48
46
  client_id: options['publishable_key'],
49
47
  # scope: 'openid+bolt.account.manage',
50
- scope: session['scope'],
48
+ scope: request.params['scope'],
51
49
  client_secret: options['api_key']
52
50
  }
53
51
 
@@ -64,9 +62,17 @@ module OmniAuth
64
62
  post_data = URI.encode_www_form(payload)
65
63
  res = http.request(req, post_data)
66
64
  response = JSON.parse(res.body)
65
+
66
+ @expiration_time = Time.now.utc + response['expires_in']
67
+ @refresh_token = response['refresh_token']
68
+ @refresh_token_scope = response['refresh_token_scope']
67
69
  @access_token = response['access_token']
68
70
  @user_uid = response['id_token']
69
71
 
72
+ # don't need these values to refresh access_token so better remove them
73
+ session.delete('authorization_code')
74
+ session.delete('scope')
75
+
70
76
  super
71
77
  end
72
78
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module Bolt
5
- VERSION = '0.0.0'
5
+ VERSION = '0.3.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-bolt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniele Palombo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-10 00:00:00.000000000 Z
11
+ date: 2022-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth