sb-omniauth-naver 0.3.3

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: de67da68e29751e90622b6ed618fe0da875885d308af8884b5e4ffbf3d657bc6
4
+ data.tar.gz: b75ff9583acff22f98f4b43e19a2d72b18077af6054b2e6db267e59adc3f113f
5
+ SHA512:
6
+ metadata.gz: 440974f11f2541cb1ffd95742ff5f522e6267e5761f64d77b6779475f9fc8cf2e7d351ad2de9c7073fbf1cae214a037d4696fb109c890b8b0524d1323f9275b4
7
+ data.tar.gz: 1fe3e985272510ee4cb96fb49b1f552a9e1f3a09db3d0699ac40f7c6d6128240a34fdb3d21552e0680ba7ef5605ad625376e68c643ee016ed20f25842af697b6
@@ -0,0 +1,61 @@
1
+ name: Ruby Gem
2
+
3
+ on:
4
+ push:
5
+ branches: [ "master" ]
6
+ pull_request:
7
+ branches: [ "master" ]
8
+
9
+ jobs:
10
+ # public이 안되는거나 마찬가지.. 안되는것만 못한 public...
11
+ # 공개 패키지를 사용하려고 해도 github token이 필요함
12
+ # build-publish-gh-packages:
13
+ # name: Build + Publish - GithubPackages
14
+ # runs-on: ubuntu-latest
15
+ # permissions:
16
+ # contents: read
17
+ # packages: write
18
+
19
+ # steps:
20
+ # - uses: actions/checkout@v4
21
+ # - name: Set up Ruby matrix
22
+ # uses: ruby/setup-ruby@v1
23
+ # with:
24
+ # ruby-version: '3.3'
25
+
26
+ # - name: Publish to Github Packages
27
+ # run: |
28
+ # mkdir -p $HOME/.gem
29
+ # touch $HOME/.gem/credentials
30
+ # chmod 0600 $HOME/.gem/credentials
31
+ # printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
32
+ # gem build *.gemspec
33
+ # gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
34
+ # env:
35
+ # GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
36
+ # OWNER: ${{ github.repository_owner }}
37
+
38
+
39
+ build-publish-rubygems:
40
+ name: Build + Publish - Rubygems
41
+ runs-on: ubuntu-latest
42
+ permissions:
43
+ contents: read
44
+
45
+ steps:
46
+ - uses: actions/checkout@v4
47
+ - name: Set up Ruby matrix
48
+ uses: ruby/setup-ruby@v1
49
+ with:
50
+ ruby-version: '3.3'
51
+
52
+ - name: Publish to RubyGems
53
+ run: |
54
+ mkdir -p $HOME/.gem
55
+ touch $HOME/.gem/credentials
56
+ chmod 0600 $HOME/.gem/credentials
57
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
58
+ gem build *.gemspec
59
+ gem push *.gem
60
+ env:
61
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
data/.gitignore ADDED
@@ -0,0 +1,23 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+
14
+ # runtime
15
+ .env
16
+ tmp-result-*.json
17
+ Gemfile.lock
18
+
19
+ # IDE
20
+ .idea/
21
+
22
+ # buid
23
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in omniauth-naver.gemspec
4
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,8 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard :rspec, :cmd => "bundle exec rspec spec" do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
+ watch('spec/spec_helper.rb') { "spec" }
8
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Surim Kim
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,79 @@
1
+ # OmniAuth Naver
2
+
3
+ This is the OmniAuth strategy for authenticating to Naver. To
4
+ use it, you'll need to sign up for an OAuth2 Application ID and Secret
5
+ on the [Naver](https://developers.naver.com/docs/login/overview).
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ Add to your `Gemfile`:
12
+ ```ruby
13
+ gem 'sb-omniauth-naver', git: git@github.com:ScriptonBasestar/sb-omniauth-naver.git
14
+
15
+ or
16
+
17
+ gem "sb-omniauth-naver", "0.3.3", source: "https://rubygems.pkg.github.com/scriptonbasestar"
18
+ ```
19
+
20
+ Then `bundle install`.
21
+
22
+ ## Usage
23
+
24
+ ### Rails
25
+
26
+ Rails Middleware 편집
27
+
28
+ `config/initializers/omniauth.rb`:
29
+ ```ruby
30
+ Rails.application.config.middleware.use OmniAuth::Builder do
31
+ # 3 중 1
32
+ provider :naver, ENV['NAVER_CLIENT_ID']
33
+ provider :naver, ENV['NAVER_CLIENT_ID'], ENV['NAVER_CLIENT_SECRET']
34
+ provider :naver, ENV['NAVER_CLIENT_ID'], {:redirect_path => ENV['NAVER_REDIRECT_URL']}
35
+ end
36
+ ```
37
+
38
+ ## Auth Hash
39
+
40
+ Here's an example *Auth Hash* available in `request.env['omniauth.auth']`:
41
+
42
+ ```ruby
43
+ {
44
+ :provider=>"naver",
45
+ :uid=>"48436401",
46
+ :info=>{
47
+ :name=>"홍길동",
48
+ :email=>"foobar@naver.com",
49
+ :gender=>"male",
50
+ :image=>"https://phinf.pstatic.net/contactthumb/52/2014/8/4/kimsuerim_1407162661934.jpg",
51
+ :nickname=>"길동"
52
+ },
53
+ :credentials=>{
54
+ :token=>"AAAAObBDnBitK5i1qRDH4S2OUFvBMMsxWURxpLPNPhQyIyb7bIfH/dUqf1T3e5a5A87X6SntI74aUVIMPupBqKPYB3s=",
55
+ :refresh_token=>"zdaiiVqKazKWlunUlTbgqjGs0LujvvWjNipKMQSXRQipVFJ5PT0TjNTaq1Yj3oRkaCAUAtMAxHipX2qqzdRNxDoetN7h1Z68YICNujmBjdcZ8aT93sNqxMKXwBgsKW6LPlez",
56
+ :expires_at=>1526543399,
57
+ :expires=>true
58
+ },
59
+ :extra=>{
60
+ :raw_info=>{
61
+ :resultcode=>"00",
62
+ :message=>"success",
63
+ :response=>{
64
+ :id=>"48436401",
65
+ :nickname=>"길동",
66
+ :profile_image=>"https://phinf.pstatic.net/contactthumb/52/2014/8/4/kimsuerim_1407162661934.jpg",
67
+ :age=>"30-39",
68
+ :gender=>"M",
69
+ :email=>"foobar@naver.com",
70
+ :name=>"홍길동",
71
+ :birthday=>"01-08"
72
+ }
73
+ }
74
+ }
75
+ }
76
+ ```
77
+
78
+ ## Contributors
79
+ Issue or Fork PR
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,8 @@
1
+ NAVER_CLIENT_ID=your_kakao_client_id
2
+ NAVER_CLIENT_SECRET=your_kakao_client_secret
3
+ NAVER_CLIENT_SCOPE=
4
+ NAVER_REDIRECT_URL=http://localhost:3000/auth/naver/callback
5
+
6
+ RACK_COOKIE_SECRET=a3f5e6d7c8b9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5
7
+
8
+ OAUTH_DEBUG=true
data/example/Gemfile ADDED
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ group :development, :test do
6
+ gem "growl"
7
+ gem "guard"
8
+ gem "guard-bundler"
9
+ gem "guard-rspec"
10
+ gem "rb-fsevent"
11
+
12
+ gem "dotenv"
13
+
14
+ gem "sb-omniauth-naver", path: "../"
15
+
16
+ gem "byebug"
17
+
18
+ gem "sinatra"
19
+
20
+ gem "puma"
21
+ gem "rackup"
22
+
23
+ gem "rerun"
24
+ end
data/example/Makefile ADDED
@@ -0,0 +1,12 @@
1
+ setup:
2
+ cp .env.sample .env
3
+ ruby -e "require 'securerandom'; puts SecureRandom.hex(32)"
4
+
5
+ start:
6
+ ruby app.rb
7
+ # rackup config.ru
8
+ bundle exec rackup -p 3000
9
+
10
+ dev:
11
+ # https://github.com/alexch/rerun
12
+ rerun -- rackup --port 3000 config.ru
data/example/config.ru ADDED
@@ -0,0 +1,298 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rubygems"
4
+ require "bundler"
5
+ require "sinatra"
6
+ require "omniauth"
7
+ require "faraday"
8
+ require "logger"
9
+ require "byebug"
10
+
11
+ require "sb-omniauth-naver"
12
+
13
+ require "dotenv"
14
+ Dotenv.load
15
+
16
+ # Do not use for production code.
17
+ # This is only to make setup easier when running through the sample.
18
+ #
19
+ # If you do have issues with certs in production code, this could help:
20
+ # http://railsapps.github.io/openssl-certificate-verify-failed.html
21
+ # OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
22
+
23
+ class App < Sinatra::Base
24
+ configure do
25
+ set :sessions, true
26
+ set :inline_templates, true
27
+
28
+ # STDOUT의 sync 활성화로 버퍼링 방지
29
+ STDOUT.sync = true
30
+
31
+ # 로깅 설정
32
+ $logger = Logger.new(STDOUT)
33
+ $logger.level = Logger::DEBUG
34
+
35
+ # Sinatra 로깅 활성화
36
+ enable :logging
37
+ set :logger, $logger
38
+ end
39
+
40
+ before do
41
+ env["rack.logger"] = $logger
42
+ end
43
+
44
+ use Rack::Session::Cookie, secret: ENV.fetch("RACK_COOKIE_SECRET", "a3f5e6d7c8b9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5")
45
+
46
+ # OAuth2 클라이언트의 로거를 Sinatra의 로거로 설정
47
+ OAuth2::Client.class_eval do
48
+ define_method(:logger) { $logger }
49
+ end
50
+ OmniAuth.config.logger = $logger
51
+ use OmniAuth::Builder do
52
+ # provider :naver, ENV.fetch("NAVER_CLIENT_ID", nil), ENV.fetch("NAVER_CLIENT_SECRET", nil), access_type: "offline", prompt: "consent", provider_ignores_state: true, scope: "account_email,profile", :strategy_class => OmniAuth::Strategies::NaverOauth2
53
+ # provider :naver, ENV.fetch("NAVER_CLIENT_ID", nil), ENV.fetch("NAVER_CLIENT_SECRET", nil),
54
+ # scope: ENV.fetch("NAVER_CLIENT_SCOPE", "profile"),
55
+ # client_options: {
56
+ # connection_build: lambda do |builder|
57
+ # builder.request :url_encoded
58
+ # builder.response :logger, $logger
59
+ # builder.adapter Faraday.default_adapter
60
+ # end
61
+ # }
62
+ provider :naver, ENV.fetch("NAVER_CLIENT_ID", nil), ENV.fetch("NAVER_CLIENT_SECRET", nil),
63
+ scope: ENV.fetch("NAVER_CLIENT_SCOPE", ""), redirect_url: ENV.fetch("NAVER_REDIRECT_URL") do |builder|
64
+ builder.client_options.connection_build do |conn|
65
+ conn.request :url_encoded
66
+ conn.response :logger, $logger, { headers: true, bodies: { request: false, response: true }, errors: true }
67
+ conn.adapter Faraday.default_adapter
68
+ end
69
+ # connection_build
70
+
71
+ # provider :naver, "bcf75d0d9b0781ac4305d8750972ce25", "W7oQ3tX4Z9wj9gPJRqFlJ2waVVLTLfY8",
72
+ # scope: "profile,account_email" do |builder|
73
+ # builder.request :url_encoded
74
+ # # builder.response :logger, $logger, bodies: true
75
+ # builder.response :logger, $logger, { headers: true, bodies: { request: false, response: true }, errors: true }
76
+ # builder.adapter Faraday.default_adapter
77
+ end
78
+ # before_request_phase do |env|
79
+ # puts "before_request_phase >>>>>>>>>>"
80
+ # puts env["rack.session"]
81
+ # puts env["rack.session"]["user_params"]
82
+ # puts env["rack.request.form_hash"]["user"]
83
+ # request_env = env['omniauth.auth']
84
+ # print request_env
85
+ # puts "before_request_phase <<<<<<<<<<"
86
+ # end
87
+ # before_callback_phase do |env|
88
+ # puts "before_callback_phase >>>>>>>>>>"
89
+ # request_env = env['omniauth.auth']
90
+ # puts "=== OmniAuth Request ==="
91
+ # puts request_env.to_hash if request_env
92
+ #
93
+ # # puts env["rack.session"]
94
+ # # puts env["rack.session"]["user_params"]
95
+ # # puts env["rack.request.form_hash"]["user"]
96
+ # puts "before_callback_phase <<<<<<<<<<"
97
+ # end
98
+ puts "OmniAuth::Strategies::NaverOauth2"
99
+ puts "NAVER_CLIENT_ID: #{ENV.fetch("NAVER_CLIENT_ID", nil)}"
100
+ puts "NAVER_CLIENT_SECRET: #{ENV.fetch("NAVER_CLIENT_SECRET", nil)}"
101
+ # on_failure do |env|
102
+ # error = env["omniauth.error"]
103
+ # puts "OmniAuth error: #{error.inspect}"
104
+ # OmniAuth::FailureEndpoint.new(env).redirect_to_failure
105
+ # end
106
+ end
107
+
108
+ get "/" do
109
+ logger.info "========================================================"
110
+ logger.debug "========================================================"
111
+ logger.info "route GET /"
112
+ <<-HTML
113
+ <!DOCTYPE html>
114
+ <html>
115
+ <head>
116
+ <title>Naver OAuth2 Example</title>
117
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
118
+ <script>
119
+ jQuery(function() {
120
+ return $.ajax({
121
+ url: 'https://apis.google.com/js/client:plus.js?onload=gpAsyncInit',
122
+ dataType: 'script',
123
+ cache: true
124
+ });
125
+ });
126
+
127
+ window.gpAsyncInit = function() {
128
+ gapi.auth.authorize({
129
+ immediate: true,
130
+ response_type: 'code',
131
+ cookie_policy: 'single_host_origin',
132
+ client_id: "#{ENV.fetch("NAVER_CLIENT_ID", nil)}",
133
+ scope: 'account_email profile'
134
+ }, function(response) {
135
+ return;
136
+ });
137
+ $('.naver-login').click(function(e) {
138
+ e.preventDefault();
139
+ gapi.auth.authorize({
140
+ immediate: false,
141
+ response_type: 'code',
142
+ cookie_policy: 'single_host_origin',
143
+ client_id: "#{ENV.fetch("NAVER_CLIENT_ID", nil)}",
144
+ # scope: 'account_email profile'
145
+ scope: 'profile'
146
+ }, function(response) {
147
+ if (response && !response.error) {
148
+ // naver authentication succeed, now post data to server.
149
+ jQuery.ajax({type: 'POST', url: "/auth/naver/callback", data: response,
150
+ success: function(data) {
151
+ // Log the data returning from naver.
152
+ console.log(data)
153
+ }
154
+ });
155
+ } else {
156
+ // naver authentication failed.
157
+ console.log("FAILED")
158
+ }
159
+ });
160
+ });
161
+ };
162
+ </script>
163
+ </head>
164
+ <body>
165
+ <ul>
166
+ <li>
167
+ <form method='post' action='/auth/naver'>
168
+ <input type="hidden" name="authenticity_token" value="#{request.env["rack.session"]["csrf"]}">
169
+ <button type='submit'>Login with Naver</button>
170
+ </form>
171
+ </li>
172
+ <li><a href='#' class="naver-login">Sign in with Naver via AJAX</a></li>
173
+ </ul>
174
+ </body>
175
+ </html>
176
+ HTML
177
+ end
178
+
179
+ helpers do
180
+ def render_callback_page(auth, url)
181
+ <<-HTML
182
+ <!DOCTYPE html>
183
+ <html lang="en">
184
+ <head>
185
+ <meta charset="UTF-8">
186
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
187
+ <title>OmniAuth Callback - #{url}</title>
188
+ <style>
189
+ body {
190
+ font-family: Arial, sans-serif;
191
+ margin: 0;
192
+ padding: 0;
193
+ background-color: #f9f9f9;
194
+ color: #333;
195
+ }
196
+ header {
197
+ background-color: #4CAF50;
198
+ color: white;
199
+ padding: 1rem;
200
+ text-align: center;
201
+ }
202
+ .container {
203
+ max-width: 800px;
204
+ margin: 2rem auto;
205
+ padding: 1rem;
206
+ background: white;
207
+ border-radius: 8px;
208
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
209
+ }
210
+ h1 {
211
+ font-size: 1.5rem;
212
+ margin-bottom: 1rem;
213
+ }
214
+ pre {
215
+ background: #f4f4f4;
216
+ padding: 1rem;
217
+ border-radius: 8px;
218
+ overflow-x: auto;
219
+ font-size: 0.9rem;
220
+ }
221
+ </style>
222
+ </head>
223
+ <body>
224
+ <header>
225
+ <h1>OmniAuth Callback - #{url}</h1>
226
+ </header>
227
+ <div class="container">
228
+ <h1>#{params[:provider].capitalize} Callback Success</h1>
229
+ <p>The callback from <strong>#{params[:provider].capitalize}</strong> was successful. Below is the data received:</p>
230
+ <pre>#{JSON.pretty_generate(auth)}</pre>
231
+ </div>
232
+ </body>
233
+ </html>
234
+ HTML
235
+ end
236
+ end
237
+
238
+ post "/auth/:provider/callback" do
239
+ logger.info "========================================================"
240
+ logger.info "route POST /auth/:provider/callback"
241
+ # content_type "text/plain"
242
+ begin
243
+ logger.info "begin"
244
+ auth = request.env["omniauth.auth"]
245
+ logger.info auth
246
+ logger.info auth.to_hash
247
+ # request.env["omniauth.auth"].to_hash.inspect
248
+
249
+ render_callback_page(auth, request.url)
250
+ rescue StandardError
251
+ "No Data"
252
+ end
253
+ end
254
+
255
+ get "/auth/:provider/callback" do
256
+ logger.info "========================================================"
257
+ logger.info "route GET /auth/:provider/callback"
258
+ # content_type "text/plain"
259
+ begin
260
+ logger.info "begin"
261
+ auth = request.env["omniauth.auth"]
262
+ logger.info auth
263
+ logger.info auth.to_hash
264
+ # request.env["omniauth.auth"].to_hash.inspect
265
+
266
+ render_callback_page(auth, request.url)
267
+ rescue StandardError
268
+ "No Data"
269
+ end
270
+ end
271
+
272
+ get "/auth/failure" do
273
+ logger.info "========================================================"
274
+ logger.info "route GET /auth/failure"
275
+ begin
276
+ logger.info "begin"
277
+ logger.info request.env["omniauth.auth"]
278
+ logger.info request.env["omniauth.auth"].to_hash
279
+ request.env["omniauth.auth"].to_hash.inspect
280
+ rescue StandardError
281
+ <<-HTML
282
+ <!DOCTYPE html>
283
+ <html>
284
+ <head>
285
+ <title>Naver OAuth2 Example</title>
286
+ </head>
287
+ <body>
288
+ <h1>No Data</h1>
289
+ <p>Request Params: #{request.params.inspect}</p>
290
+ </body>
291
+ </html>
292
+ HTML
293
+ end
294
+ end
295
+ end
296
+
297
+ use Rack::CommonLogger, $logger
298
+ run App.new
@@ -0,0 +1,59 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class Naver < OmniAuth::Strategies::OAuth2
6
+ option :name, 'naver'
7
+
8
+ option :client_options, {
9
+ site: 'https://nid.naver.com',
10
+ authorize_url: 'https://nid.naver.com/oauth2.0/authorize',
11
+ token_url: 'https://nid.naver.com/oauth2.0/token',
12
+ }
13
+
14
+ uid { raw_properties['id'].to_s }
15
+
16
+ info do
17
+ {
18
+ 'name' => raw_properties['name'],
19
+ 'email' => raw_properties['email'],
20
+ 'gender' => gender,
21
+ 'image' => image,
22
+ 'nickname' => raw_properties['nickname']
23
+ }
24
+ end
25
+
26
+ extra do
27
+ {raw_info: raw_info}
28
+ end
29
+
30
+ private
31
+
32
+ def gender
33
+ return if raw_properties['gender'].nil?
34
+ return 'male' if raw_properties['gender'].include? 'M'
35
+ return 'female' if raw_properties['gender'].include? 'F'
36
+ end
37
+
38
+ def image
39
+ return if raw_properties['profile_image'].nil?
40
+ return raw_properties['profile_image'].sub('?type=s80', '') unless raw_properties['profile_image'].include? 'nodata_33x33.gif'
41
+ end
42
+
43
+ def raw_info
44
+ OmniAuth.logger.send :debug, "raw_info >>>>>>>>>>"
45
+ OmniAuth.logger.send :debug, "access_token: #{access_token.token}"
46
+ @raw_info ||= access_token.get('https://openapi.naver.com/v1/nid/me').parsed
47
+ OmniAuth.logger.send :debug, "raw_info: #{@raw_info}"
48
+ OmniAuth.logger.send :debug, "raw_info ----------"
49
+ @raw_info
50
+ end
51
+
52
+ def raw_properties
53
+ @raw_properties ||= raw_info['response']
54
+ end
55
+ end
56
+ end
57
+ end
58
+
59
+ OmniAuth.config.add_camelization 'naver', 'Naver'
@@ -0,0 +1,5 @@
1
+ module Omniauth
2
+ module Naver
3
+ VERSION = '0.3.3'.freeze
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ require "omniauth-naver/version"
2
+ require 'omniauth/strategies/naver'
3
+
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "omniauth-naver/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "sb-omniauth-naver"
8
+ spec.version = Omniauth::Naver::VERSION
9
+ spec.platform = Gem::Platform::RUBY
10
+ spec.authors = ["archmagece"]
11
+ spec.email = ["archmagece@users.noreply.github.com"]
12
+
13
+ spec.homepage = "https://github.com/ScriptonBasestar/sb-omniauth-naver"
14
+ spec.summary = %q{OmniAuth strategy for Kakao}
15
+ spec.description = %q{OmniAuth strategy for Kakao(http://developerspec.naver.com/)}
16
+ spec.license = "MIT"
17
+
18
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
+ spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_dependency 'omniauth', '~> 2.1'
24
+ spec.add_dependency 'omniauth-oauth2', '~> 1.8'
25
+
26
+ spec.add_development_dependency 'bundler', '~> 2.6'
27
+ spec.add_development_dependency 'rake', '~> 13.2'
28
+ spec.add_development_dependency 'rspec', '~> 3.13'
29
+ spec.add_development_dependency 'guard-rspec', '~> 4.7'
30
+ spec.add_development_dependency 'fakeweb', '~> 1.3'
31
+ spec.add_development_dependency 'minitest', '~> 5.25'
32
+ end
metadata ADDED
@@ -0,0 +1,170 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sb-omniauth-naver
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.3
5
+ platform: ruby
6
+ authors:
7
+ - archmagece
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2025-05-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omniauth
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: omniauth-oauth2
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.8'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.8'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.6'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '13.2'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '13.2'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.13'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.13'
83
+ - !ruby/object:Gem::Dependency
84
+ name: guard-rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '4.7'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '4.7'
97
+ - !ruby/object:Gem::Dependency
98
+ name: fakeweb
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.3'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.3'
111
+ - !ruby/object:Gem::Dependency
112
+ name: minitest
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '5.25'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '5.25'
125
+ description: OmniAuth strategy for Kakao(http://developerspec.naver.com/)
126
+ email:
127
+ - archmagece@users.noreply.github.com
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - ".github/workflows/gem-push.yml"
133
+ - ".gitignore"
134
+ - Gemfile
135
+ - Guardfile
136
+ - LICENSE.txt
137
+ - README.md
138
+ - Rakefile
139
+ - example/.env.sample
140
+ - example/Gemfile
141
+ - example/Makefile
142
+ - example/config.ru
143
+ - lib/omniauth-naver/version.rb
144
+ - lib/omniauth/strategies/naver.rb
145
+ - lib/sb-omniauth-naver.rb
146
+ - sb-omniauth-naver.gemspec
147
+ homepage: https://github.com/ScriptonBasestar/sb-omniauth-naver
148
+ licenses:
149
+ - MIT
150
+ metadata: {}
151
+ post_install_message:
152
+ rdoc_options: []
153
+ require_paths:
154
+ - lib
155
+ required_ruby_version: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ required_rubygems_version: !ruby/object:Gem::Requirement
161
+ requirements:
162
+ - - ">="
163
+ - !ruby/object:Gem::Version
164
+ version: '0'
165
+ requirements: []
166
+ rubygems_version: 3.5.22
167
+ signing_key:
168
+ specification_version: 4
169
+ summary: OmniAuth strategy for Kakao
170
+ test_files: []