From eee2d3c1af23c45354e12768692a52e7c119de24 Mon Sep 17 00:00:00 2001 From: rob Date: Tue, 5 Jul 2022 16:09:30 -0400 Subject: [PATCH] Additional OAuth2 logging --- app/services/oauth2.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/services/oauth2.js b/app/services/oauth2.js index d067858..6932764 100644 --- a/app/services/oauth2.js +++ b/app/services/oauth2.js @@ -167,10 +167,13 @@ class OAuth2Service extends SiteService { async processExchange (client, code, redirectUri, done) { try { const ac = await OAuth2AuthorizationCode.findOne({ code }); + this.log.debug('process OAuth2 exchange', { client, code, redirectUri }); if (client.id !== ac.clientId) { + this.log.alert('OAuth2 client ID mismatch', { provided: client.id, onfile: ac.clientId }); return done(null, false); } if (redirectUri !== ac.redirectUri) { + this.log.alert('OAuth2 redirect mismatch', { provided: redirectUri, onfile: ac.redirectUri }); return done(null, false); } @@ -183,6 +186,7 @@ class OAuth2Service extends SiteService { }); await at.save(); + this.log.debug('OAuth2 grant exchanged for token', { client, code, token: at.token }); return done(null, token); } catch (error) { this.log.error('failed to process OAuth2 exchange', { error });