Class: OmniAuth::Strategies::Kakao

Inherits:
OAuth2
  • Object
show all
Defined in:
lib/omniauth/strategies/kakao.rb

Constant Summary collapse

DEFAULT_REDIRECT_PATH =
"/oauth"

Instance Method Summary collapse

Constructor Details

#initialize(app, *args, &block) ⇒ Kakao

Returns a new instance of Kakao.



29
30
31
32
# File 'lib/omniauth/strategies/kakao.rb', line 29

def initialize(app, *args, &block)
  super
  options[:callback_path] = options[:redirect_path] || DEFAULT_REDIRECT_PATH
end

Instance Method Details

#callback_phaseObject



34
35
36
37
38
39
# File 'lib/omniauth/strategies/kakao.rb', line 34

def callback_phase
  previous_callback_path = options.delete(:callback_path)
  @env["PATH_INFO"] = callback_path
  options[:callback_path] = previous_callback_path
  super
end

#callback_urlObject

callback_uri와 관련해서 redirect_uri_mismatch 문제가 나오던것을 path match를 통해서 해결합니다. 해당 문제는 devtalk.kakao.com/t/rest-api-omniauth/19207 에서 나오는 문제를 해결합니다. NOTE If we’re using code from the signed request then FB sets the redirect_uri to ” during the authorize

phase and it must match during the access_token phase:
https://github.com/facebook/facebook-php-sdk/blob/master/src/base_facebook.php#L477


46
47
48
49
50
51
52
53
# File 'lib/omniauth/strategies/kakao.rb', line 46

def callback_url
  if @authorization_code_from_signed_request_in_cookie
    ''
  else
    # callback url ignorance issue from https://github.com/intridea/omniauth-oauth2/commit/85fdbe117c2a4400d001a6368cc359d88f40abc7
    options[:callback_url] || (full_host + script_name + callback_path)
  end
end

#mock_call!Object



55
56
57
58
# File 'lib/omniauth/strategies/kakao.rb', line 55

def mock_call!(*)
  options.delete(:callback_path)
  super
end