diff --git a/app/services/oauth2.js b/app/services/oauth2.js index c581ec1..36e77e2 100644 --- a/app/services/oauth2.js +++ b/app/services/oauth2.js @@ -178,7 +178,7 @@ class OAuth2Service extends SiteService { * calling host. */ - const client = await OAuth2Client.updateOne( + const client = await OAuth2Client.findOneAndUpdate( { 'site.domain': clientDefinition.domain, 'site.domainKey': clientDefinition.domainKey, @@ -199,7 +199,10 @@ class OAuth2Service extends SiteService { redirectUri: clientDefinition.coreAuth.redirectUri, }, }, - { upsert: true, returnDocument: true }, + { + upsert: true, // create if it doesn't exist + "new": true, // return the modified version + }, ); this.log.info('new OAuth2 client updated', {