Skip to content

Commit

Permalink
Even more verbose logging of tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
oprypin committed Jan 30, 2021
1 parent d591d28 commit 0c4a744
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion github_api.cr
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,17 @@ end
struct InstallationToken < Token
include JSON::Serializable
getter token : String
property! installation_id : InstallationId

def initialize(@token : String)
end

def to_s
if (installation_id = @installation_id)
Log.info { "Using token for ##{installation_id}" }
end
super
end
end

struct OAuthToken < Token
Expand Down Expand Up @@ -70,7 +78,9 @@ class GitHubAppAuth
headers: {Authorization: jwt}
)
resp.raise_for_status
InstallationToken.from_json(resp.body)
tok = InstallationToken.from_json(resp.body)
tok.installation_id = installation_id
tok
end

TOKEN_EXPIRATION = 55.minutes
Expand Down

0 comments on commit 0c4a744

Please sign in to comment.