Skip to content

Commit

Permalink
Change debug logging of received tokens to avoid truncating
Browse files Browse the repository at this point in the history
Long lines are truncated.
  • Loading branch information
jirutka committed Sep 12, 2023
1 parent 8755d3f commit 63bddcd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/handlers/callback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ export const callback: RequestHandler = async (ctx) => {
log.debug?.(`callback: requesting tokens using auth code: ${code}`)

const tokenSet = await requestToken(ctx, 'authorization_code', code)
log.debug?.(`callback: received id_token=${tokenSet.id_token},`
+ ` access_token=${tokenSet.access_token}, refresh_token=${tokenSet.refresh_token}`)
log.debug?.(`callback: received id_token=${tokenSet.id_token}`)
log.debug?.(`callback: received access_token=${tokenSet.access_token}`)
log.debug?.(`callback: received refresh_token=${tokenSet.refresh_token}`)

await validateJwtSign(ctx, tokenSet.id_token)
const { nonce, username } = await decodeAndValidateIdToken(conf, tokenSet.id_token)
Expand Down
5 changes: 3 additions & 2 deletions src/oauth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,9 @@ export async function refreshTokens (ctx: Context, refreshToken: string): Promis
const tokenSet = await requestToken(ctx, 'refresh_token', refreshToken) as DecodedTokenResponse
const { access_token, id_token, refresh_token } = tokenSet

log.debug?.(`oauth: token refreshed, got id_token=${id_token}, access_token=${access_token},`
+ ` refresh_token=${refresh_token}`)
log.debug?.(`oauth: token refreshed, received id_token=${id_token}`)
log.debug?.(`oauth: token refreshed, received access_token=${access_token}`)
log.debug?.(`oauth: token refreshed, received refresh_token=${refresh_token}`)

await validateJwtSign(ctx, id_token)
tokenSet.idToken = await decodeAndValidateIdToken(conf, id_token)
Expand Down

0 comments on commit 63bddcd

Please sign in to comment.