authkeeper 0.1.17 → 0.1.19
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 +5 -0
- data/app/lib/authkeeper/vk_ads_auth_api/client.rb +13 -0
- data/app/lib/authkeeper/vk_ads_auth_api/requests/access_token.rb +55 -0
- data/app/lib/authkeeper/vk_auth_api/requests/access_token.rb +13 -0
- data/lib/authkeeper/container.rb +1 -0
- data/lib/authkeeper/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d7346e853e67521c918e65be3551ea00ab7e1c0bafb02238c92b8ad2b17b4010
|
|
4
|
+
data.tar.gz: c719c1bbbce2e0550dabe41dcd02c5e1d034e68b529064e6b03cca4831745e01
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4f4c55a3e6ec6422eb46e86f5d9d6e8aa0bc135c9e86266072cff21c169beab5cb67baefd89bd46dee795e21c53c361ad386860e469f27c266ce9f93006cedbf
|
|
7
|
+
data.tar.gz: de8b3f18dd83a50c3a8b08b630f78337b94e7f054e61ccc88b82963a7a4b33b1a9f59f5ef3d8899ae88d73ad102f3c4821ff8e79c9ddaf2154871e69c61b7f34
|
|
@@ -10,6 +10,7 @@ module Authkeeper
|
|
|
10
10
|
when :google then google_oauth_link
|
|
11
11
|
when :yandex then yandex_oauth_link
|
|
12
12
|
when :vk then vk_oauth_link(oauth_data)
|
|
13
|
+
when :vk_ads then vk_oauth_link(oauth_data)
|
|
13
14
|
end
|
|
14
15
|
end
|
|
15
16
|
|
|
@@ -39,6 +40,10 @@ module Authkeeper
|
|
|
39
40
|
def vk_oauth_link(oauth_data)
|
|
40
41
|
"https://id.vk.com/authorize?scope=email%20phone%20ads&response_type=code&client_id=#{oauth_data[:client_id] || value(:vk, :client_id)}&code_challenge=#{oauth_data[:code_challenge]}&code_challenge_method=S256&redirect_uri=#{oauth_data[:redirect_url] || value(:vk, :redirect_url)}&state=#{oauth_data[:state]}"
|
|
41
42
|
end
|
|
43
|
+
|
|
44
|
+
def vk_ads_oauth_link(oauth_data)
|
|
45
|
+
"https://ads.vk.ru/hq/settings/access?action=oauth2&response_type=code&client_id=#{oauth_data[:client_id]}&redirect_uri=#{oauth_data[:redirect_uri]}&scope=#{oauth_data[:scope]}&state=#{oauth_data[:state]}"
|
|
46
|
+
end
|
|
42
47
|
# rubocop: enable Layout/LineLength
|
|
43
48
|
|
|
44
49
|
def value(provider, key)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Authkeeper
|
|
4
|
+
module VkAdsAuthApi
|
|
5
|
+
class Client < Authkeeper::HttpService::Client
|
|
6
|
+
include Requests::AccessToken
|
|
7
|
+
|
|
8
|
+
BASE_URL = 'https://ads.vk.ru/api/v2/oauth2/'
|
|
9
|
+
|
|
10
|
+
option :url, default: proc { BASE_URL }
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'uri'
|
|
4
|
+
|
|
5
|
+
module Authkeeper
|
|
6
|
+
module VkAdsAuthApi
|
|
7
|
+
module Requests
|
|
8
|
+
module AccessToken
|
|
9
|
+
def fetch_access_token(client_id:, code:)
|
|
10
|
+
form_post(
|
|
11
|
+
path: 'token.json',
|
|
12
|
+
body: {
|
|
13
|
+
grant_type: 'authorization_code',
|
|
14
|
+
client_id: client_id,
|
|
15
|
+
code: code
|
|
16
|
+
},
|
|
17
|
+
headers: {
|
|
18
|
+
'Content-Type' => 'application/x-www-form-urlencoded'
|
|
19
|
+
}
|
|
20
|
+
)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def refresh_access_token(client_id:, refresh_token:, client_secret:)
|
|
24
|
+
form_post(
|
|
25
|
+
path: 'token.json',
|
|
26
|
+
body: {
|
|
27
|
+
grant_type: 'refresh_token',
|
|
28
|
+
client_id: client_id,
|
|
29
|
+
refresh_token: refresh_token,
|
|
30
|
+
client_secret: client_secret
|
|
31
|
+
},
|
|
32
|
+
headers: {
|
|
33
|
+
'Content-Type' => 'application/x-www-form-urlencoded'
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def remove_access_token(client_id:, client_secret:, username: nil, user_id: nil)
|
|
39
|
+
form_post(
|
|
40
|
+
path: 'token/delete.json',
|
|
41
|
+
body: {
|
|
42
|
+
client_id: client_id,
|
|
43
|
+
client_secret: client_secret,
|
|
44
|
+
username: username,
|
|
45
|
+
user_id: user_id
|
|
46
|
+
}.compact,
|
|
47
|
+
headers: {
|
|
48
|
+
'Content-Type' => 'application/x-www-form-urlencoded'
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -39,6 +39,19 @@ module Authkeeper
|
|
|
39
39
|
}
|
|
40
40
|
)
|
|
41
41
|
end
|
|
42
|
+
|
|
43
|
+
def remove_access_token(client_id:, access_token:)
|
|
44
|
+
form_post(
|
|
45
|
+
path: 'oauth2/logout',
|
|
46
|
+
body: {
|
|
47
|
+
client_id: client_id,
|
|
48
|
+
access_token: access_token
|
|
49
|
+
},
|
|
50
|
+
headers: {
|
|
51
|
+
'Content-Type' => 'application/x-www-form-urlencoded'
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
end
|
|
42
55
|
end
|
|
43
56
|
end
|
|
44
57
|
end
|
data/lib/authkeeper/container.rb
CHANGED
|
@@ -28,6 +28,7 @@ module Authkeeper
|
|
|
28
28
|
register('api.yandex.auth_client') { Authkeeper::YandexAuthApi::Client.new }
|
|
29
29
|
register('api.yandex.client') { Authkeeper::YandexApi::Client.new }
|
|
30
30
|
register('api.vk.auth_client') { Authkeeper::VkAuthApi::Client.new }
|
|
31
|
+
register('api.vk.ads_auth_client') { Authkeeper::VkAdsAuthApi::Client.new }
|
|
31
32
|
|
|
32
33
|
register('services.providers.github') { Authkeeper::Providers::Github.new }
|
|
33
34
|
register('services.providers.gitlab') { Authkeeper::Providers::Gitlab.new }
|
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.19
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bogdanov Anton
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-07-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -57,6 +57,8 @@ files:
|
|
|
57
57
|
- app/lib/authkeeper/google_auth_api/requests/fetch_access_token.rb
|
|
58
58
|
- app/lib/authkeeper/http_service/client.rb
|
|
59
59
|
- app/lib/authkeeper/jwt_encoder.rb
|
|
60
|
+
- app/lib/authkeeper/vk_ads_auth_api/client.rb
|
|
61
|
+
- app/lib/authkeeper/vk_ads_auth_api/requests/access_token.rb
|
|
60
62
|
- app/lib/authkeeper/vk_auth_api/client.rb
|
|
61
63
|
- app/lib/authkeeper/vk_auth_api/requests/access_token.rb
|
|
62
64
|
- app/lib/authkeeper/vk_auth_api/requests/info.rb
|