Skip to content

Commit

Permalink
fixed the bug (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaHoopster committed Nov 26, 2018
1 parent ea5175c commit 5a615cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lib/civic_sip_sdk/client.rb
Expand Up @@ -16,7 +16,7 @@ class Client
ENV_VAR = 'CIVIC_SIP_SDK_ENV'
TEST_ENV = 'test'

HTTP_REQUEST_METHOD = :POST
HTTP_REQUEST_METHOD = 'POST'

# Creates a client
#
Expand All @@ -40,7 +40,7 @@ def exchange_code(jwt_token:)
'Content-Type' => MIMETYPE_JSON,
'Accept' => MIMETYPE_JSON,
'Content-Length' => json_body_str.size.to_s,
'Authorization' => authorization_header(target_path: AUTH_CODE_PATH, body: json_body_str)
'Authorization' => authorization_header(body: json_body_str)
},
body: json_body_str
)
Expand All @@ -57,13 +57,13 @@ def exchange_code(jwt_token:)

private

def authorization_header(target_path:, body:)
def authorization_header(body:)
jwt_token = Crypto.jwt_token(
app_id: @config.id,
sip_base_url: BASE_URL,
data: {
method: HTTP_REQUEST_METHOD,
path: target_path
path: AUTH_CODE_PATH
},
private_key: @config.private_key
)
Expand Down
2 changes: 1 addition & 1 deletion lib/civic_sip_sdk/crypto.rb
Expand Up @@ -72,7 +72,7 @@ def self.decode_jwt_token(token:, public_hex_key:, should_verify:)
end

def self.civic_extension(secret:, body:)
hmac = OpenSSL::HMAC.digest(HMAC_DIGEST, secret, JSON.generate(body))
hmac = OpenSSL::HMAC.digest(HMAC_DIGEST, secret, body)
Base64.encode64(hmac)
end

Expand Down

0 comments on commit 5a615cb

Please sign in to comment.