Class: OmniAuth::Strategies::Bokun
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::Bokun
show all
- Defined in:
- lib/omniauth/strategies/bokun.rb
Defined Under Namespace
Classes: NoAuthorizationCodeError
Instance Method Summary
collapse
Instance Method Details
#build_access_token ⇒ Object
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/omniauth/strategies/bokun.rb', line 54
def build_access_token
token_params = options.token_params.merge(
code: authorization_code,
redirect_uri: callback_url
)
response = client.request(:post, options.client_options.token_url, {
body: URI.encode_www_form(token_params),
headers: { 'Content-Type' => 'application/x-www-form-urlencoded' }
})
parsed_response = JSON.parse(response.body)
@access_token = ::OAuth2::AccessToken.from_hash(client, parsed_response)
rescue ::OAuth2::Error => e
Rails.logger.error "[Bokun] Token exchange failed: #{e.message}"
Rails.logger.error "[Bokun] Response body: #{e.response.body}" if e.respond_to?(:response)
raise e
end
|
#callback_url ⇒ Object
74
75
76
|
# File 'lib/omniauth/strategies/bokun.rb', line 74
def callback_url
options.authorize_params[:redirect_uri] || super
end
|
#client ⇒ Object
39
40
41
42
43
44
|
# File 'lib/omniauth/strategies/bokun.rb', line 39
def client
options.client_options.merge!(
site: "https://#{subdomain}.#{domain}"
)
super
end
|
#request_phase ⇒ Object
46
47
48
49
50
51
52
|
# File 'lib/omniauth/strategies/bokun.rb', line 46
def request_phase
unless OmniAuth::Bokun::SignedRequest.new(request.params, options.client_secret).valid_signature?
Rails.logger.warn "[Bokun] HMAC verification failed"
return fail!(:invalid_credentials)
end
super
end
|