authkeeper 0.1.3 → 0.1.5
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 +4 -4
- data/app/helpers/authkeeper/application_helper.rb +1 -1
- data/app/lib/authkeeper/yandex_auth_api/client.rb +1 -1
- data/app/lib/authkeeper/yandex_auth_api/requests/access_token.rb +47 -0
- data/lib/authkeeper/version.rb +1 -1
- metadata +5 -5
- data/app/lib/authkeeper/yandex_auth_api/requests/fetch_access_token.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc7ae5d07c1884c346b471c2544044d042579ca4da69350887b654ab3b27a404
|
4
|
+
data.tar.gz: ede7994f9a7449091488b9a0fcd5ecb7d42496bf1094b327500a7e24a2070f2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e27b133c53d951fba9dc9c8167b908ebea118eaf0289915e8d8ef4318621b07f2be929a5d9a54bbadd6f169cc0db22be60a69a318ae825d2c90b5c69786367e
|
7
|
+
data.tar.gz: 4a2729b12b89b87f14d4be182c9b444c4dfe2a39fc95ec8bdea3edf9c29881d5e782695e89a8c8bad1487985d1258b6c942d92329222d95ad4e720861cb2d2e9
|
@@ -32,7 +32,7 @@ module Authkeeper
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def vk_oauth_link(oauth_data)
|
35
|
-
"https://id.vk.com/authorize?scope=email&response_type=code&client_id=#{value(:vk, :client_id)}&code_challenge=#{oauth_data[:code_challenge]}&code_challenge_method=S256&redirect_uri=#{value(:vk, :redirect_url)}&state=#{oauth_data[:state]}"
|
35
|
+
"https://id.vk.com/authorize?scope=email%20phone%20ads&response_type=code&client_id=#{value(:vk, :client_id)}&code_challenge=#{oauth_data[:code_challenge]}&code_challenge_method=S256&redirect_uri=#{value(:vk, :redirect_url)}&state=#{oauth_data[:state]}"
|
36
36
|
end
|
37
37
|
# rubocop: enable Layout/LineLength
|
38
38
|
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'uri'
|
4
|
+
require 'base64'
|
5
|
+
|
6
|
+
module Authkeeper
|
7
|
+
module YandexAuthApi
|
8
|
+
module Requests
|
9
|
+
module AccessToken
|
10
|
+
def fetch_access_token(client_id:, client_secret:, code:)
|
11
|
+
post(
|
12
|
+
path: 'token',
|
13
|
+
body: URI.encode_www_form({
|
14
|
+
grant_type: 'authorization_code',
|
15
|
+
client_id: client_id,
|
16
|
+
client_secret: client_secret,
|
17
|
+
code: code
|
18
|
+
}),
|
19
|
+
headers: {
|
20
|
+
'Content-Type' => 'application/x-www-form-urlencoded'
|
21
|
+
}
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
def refresh_access_token(client_id:, client_secret:, refresh_token:)
|
26
|
+
post(
|
27
|
+
path: 'token',
|
28
|
+
body: URI.encode_www_form({
|
29
|
+
grant_type: 'refresh_token',
|
30
|
+
refresh_token: refresh_token
|
31
|
+
}),
|
32
|
+
headers: {
|
33
|
+
'Content-Type' => 'application/x-www-form-urlencoded',
|
34
|
+
'Authorization' => "Basic #{authorization(client_id, client_secret)}"
|
35
|
+
}
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def authorization(client_id, client_secret)
|
42
|
+
Base64.encode64("#{client_id}:#{client_secret}").gsub("\n", '')
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/authkeeper/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authkeeper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bogdanov Anton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 7.2.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 7.2.2
|
27
27
|
description: Authentication engine for Ruby on Rails projects.
|
28
28
|
email:
|
29
29
|
- kortirso@gmail.com
|
@@ -58,7 +58,7 @@ files:
|
|
58
58
|
- app/lib/authkeeper/yandex_api/client.rb
|
59
59
|
- app/lib/authkeeper/yandex_api/requests/info.rb
|
60
60
|
- app/lib/authkeeper/yandex_auth_api/client.rb
|
61
|
-
- app/lib/authkeeper/yandex_auth_api/requests/
|
61
|
+
- app/lib/authkeeper/yandex_auth_api/requests/access_token.rb
|
62
62
|
- app/mailers/authkeeper/application_mailer.rb
|
63
63
|
- app/models/authkeeper/application_record.rb
|
64
64
|
- app/services/authkeeper/fetch_session_service.rb
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'uri'
|
4
|
-
|
5
|
-
module Authkeeper
|
6
|
-
module YandexAuthApi
|
7
|
-
module Requests
|
8
|
-
module FetchAccessToken
|
9
|
-
def fetch_access_token(client_id:, client_secret:, code:)
|
10
|
-
post(
|
11
|
-
path: 'token',
|
12
|
-
body: URI.encode_www_form({
|
13
|
-
grant_type: 'authorization_code',
|
14
|
-
client_id: client_id,
|
15
|
-
client_secret: client_secret,
|
16
|
-
code: code
|
17
|
-
}),
|
18
|
-
headers: {
|
19
|
-
'Content-Type' => 'application/x-www-form-urlencoded'
|
20
|
-
}
|
21
|
-
)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|