omniauth-qiita-v2 1.4.0 → 2.0.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 +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +5 -5
- data/lib/omniauth/qiita_v2/version.rb +1 -1
- data/lib/omniauth/strategies/{qiita_v2.rb → qiita.rb} +10 -10
- data/lib/omniauth-qiita-v2.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dee9d9dfd137e1ddb357b084693617f3fe145e8898bbe0908ac6db9f11116169
|
|
4
|
+
data.tar.gz: eeb7534f5474e5a11698ac04698f2eae4831564824c64928d2d11b24c4dd6e10
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 911ab5c0b662b3265733b5f6a1a8419afcd6e5f0fcc98fb5067b12ebcc98d95abe54c260e28a98d49fcb92b437b04461c283877ab0a867b4fad9c613dcd75f95
|
|
7
|
+
data.tar.gz: 13c0cb04b16efec36f08e3d0b8d455463e5ee05b4355007ff6ae84d233d58982dc27bf42bd48801c641e5d7bfe8544928edbb979e9a2bc8700df2d094f47fe36
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.0.0] - 2025-11-28
|
|
4
|
+
|
|
5
|
+
- Rename strategy from `QiitaV2` to `Qiita`
|
|
6
|
+
|
|
7
|
+
## [1.5.0] - 2025-08-02
|
|
8
|
+
|
|
9
|
+
- Refactor: Refactor `OmniAuth::Strategies::QiitaV2#authorize_params`
|
|
10
|
+
- Test: Update test
|
|
11
|
+
- Other: Update .rubocop.yml
|
|
12
|
+
|
|
3
13
|
## [1.4.0] - 2025-07-20
|
|
4
14
|
|
|
5
15
|
- New: Update auth hash
|
data/README.md
CHANGED
|
@@ -38,7 +38,7 @@ Add the following to `config/initializers/devise.rb`:
|
|
|
38
38
|
```ruby
|
|
39
39
|
# config/initializers/devise.rb
|
|
40
40
|
Devise.setup do |config|
|
|
41
|
-
config.omniauth :
|
|
41
|
+
config.omniauth :qiita, ENV['QIITA_CLIENT_ID'], ENV['QIITA_CLIENT_SECRET']
|
|
42
42
|
end
|
|
43
43
|
```
|
|
44
44
|
|
|
@@ -57,7 +57,7 @@ Add the OmniAuth configuration to your Devise model:
|
|
|
57
57
|
class User < ApplicationRecord
|
|
58
58
|
devise :database_authenticatable, :registerable,
|
|
59
59
|
:recoverable, :rememberable, :validatable,
|
|
60
|
-
:omniauthable, omniauth_providers: [:
|
|
60
|
+
:omniauthable, omniauth_providers: [:qiita]
|
|
61
61
|
end
|
|
62
62
|
```
|
|
63
63
|
|
|
@@ -68,10 +68,10 @@ You can configure several options:
|
|
|
68
68
|
```ruby
|
|
69
69
|
# config/initializers/devise.rb
|
|
70
70
|
Devise.setup do |config|
|
|
71
|
-
config.omniauth :
|
|
71
|
+
config.omniauth :qiita, ENV['QIITA_CLIENT_ID'], ENV['QIITA_CLIENT_SECRET'],
|
|
72
72
|
{
|
|
73
73
|
scope: 'read_qiita write_qiita', # Specify OAuth scopes
|
|
74
|
-
callback_path: '/custom/
|
|
74
|
+
callback_path: '/custom/qiita/callback' # Custom callback path
|
|
75
75
|
}
|
|
76
76
|
end
|
|
77
77
|
```
|
|
@@ -87,7 +87,7 @@ After successful authentication, the auth hash will be available in `request.env
|
|
|
87
87
|
|
|
88
88
|
```ruby
|
|
89
89
|
{
|
|
90
|
-
provider: '
|
|
90
|
+
provider: 'qiita',
|
|
91
91
|
uid: 'qiita',
|
|
92
92
|
info: {
|
|
93
93
|
name: 'Qiita キータ',
|
|
@@ -4,22 +4,18 @@ require 'omniauth-oauth2'
|
|
|
4
4
|
|
|
5
5
|
module OmniAuth
|
|
6
6
|
module Strategies
|
|
7
|
-
class
|
|
7
|
+
class Qiita < OmniAuth::Strategies::OAuth2
|
|
8
8
|
DEFAULT_SCOPE = 'read_qiita'
|
|
9
9
|
USER_INFO_URL = '/api/v2/authenticated_user'
|
|
10
10
|
|
|
11
|
-
option :name, '
|
|
12
|
-
|
|
11
|
+
option :name, 'qiita'
|
|
13
12
|
option :client_options, {
|
|
14
13
|
site: 'https://qiita.com',
|
|
15
14
|
authorize_url: '/api/v2/oauth/authorize',
|
|
16
15
|
token_url: '/api/v2/access_tokens'
|
|
17
16
|
}
|
|
18
|
-
|
|
19
17
|
option :token_params, { parse: :json }
|
|
20
|
-
|
|
21
18
|
option :authorize_options, [:scope, :state]
|
|
22
|
-
|
|
23
19
|
option :scope, DEFAULT_SCOPE
|
|
24
20
|
|
|
25
21
|
uid { raw_info['id'] }
|
|
@@ -67,11 +63,11 @@ module OmniAuth
|
|
|
67
63
|
|
|
68
64
|
def authorize_params
|
|
69
65
|
super.tap do |params|
|
|
70
|
-
[
|
|
71
|
-
params[
|
|
66
|
+
options[:authorize_options].each do |key|
|
|
67
|
+
params[key] = request.params[key.to_s] unless empty?(request.params[key.to_s])
|
|
72
68
|
end
|
|
73
69
|
params[:scope] ||= DEFAULT_SCOPE
|
|
74
|
-
session['omniauth.state'] = params[:state]
|
|
70
|
+
session['omniauth.state'] = params[:state] unless empty?(params[:state])
|
|
75
71
|
end
|
|
76
72
|
end
|
|
77
73
|
|
|
@@ -86,10 +82,14 @@ module OmniAuth
|
|
|
86
82
|
def prune!(hash)
|
|
87
83
|
hash.delete_if do |_, value|
|
|
88
84
|
prune!(value) if value.is_a?(Hash)
|
|
89
|
-
|
|
85
|
+
empty?(value)
|
|
90
86
|
end
|
|
91
87
|
end
|
|
92
88
|
|
|
89
|
+
def empty?(value)
|
|
90
|
+
value.nil? || (value.respond_to?(:empty?) && value.empty?)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
93
|
def base_params
|
|
94
94
|
{
|
|
95
95
|
headers: {
|
data/lib/omniauth-qiita-v2.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: omniauth-qiita-v2
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Masahiro
|
|
@@ -51,16 +51,16 @@ files:
|
|
|
51
51
|
- Rakefile
|
|
52
52
|
- lib/omniauth-qiita-v2.rb
|
|
53
53
|
- lib/omniauth/qiita_v2/version.rb
|
|
54
|
-
- lib/omniauth/strategies/
|
|
55
|
-
homepage: https://github.com/cadenza-tech/omniauth-qiita-v2/tree/
|
|
54
|
+
- lib/omniauth/strategies/qiita.rb
|
|
55
|
+
homepage: https://github.com/cadenza-tech/omniauth-qiita-v2/tree/v2.0.0
|
|
56
56
|
licenses:
|
|
57
57
|
- MIT
|
|
58
58
|
metadata:
|
|
59
|
-
homepage_uri: https://github.com/cadenza-tech/omniauth-qiita-v2/tree/
|
|
60
|
-
source_code_uri: https://github.com/cadenza-tech/omniauth-qiita-v2/tree/
|
|
61
|
-
changelog_uri: https://github.com/cadenza-tech/omniauth-qiita-v2/blob/
|
|
59
|
+
homepage_uri: https://github.com/cadenza-tech/omniauth-qiita-v2/tree/v2.0.0
|
|
60
|
+
source_code_uri: https://github.com/cadenza-tech/omniauth-qiita-v2/tree/v2.0.0
|
|
61
|
+
changelog_uri: https://github.com/cadenza-tech/omniauth-qiita-v2/blob/v2.0.0/CHANGELOG.md
|
|
62
62
|
bug_tracker_uri: https://github.com/cadenza-tech/omniauth-qiita-v2/issues
|
|
63
|
-
documentation_uri: https://rubydoc.info/gems/omniauth-qiita-v2/
|
|
63
|
+
documentation_uri: https://rubydoc.info/gems/omniauth-qiita-v2/2.0.0
|
|
64
64
|
funding_uri: https://patreon.com/CadenzaTech
|
|
65
65
|
rubygems_mfa_required: 'true'
|
|
66
66
|
rdoc_options: []
|