fix(server/authcode): guard against null challenges (#2643)

- the database expects challenge to be not null, so we should guard against this early before consuming database resources
This commit is contained in:
Iain Sproat
2024-08-13 09:12:06 +01:00
committed by GitHub
parent a0a1363e01
commit 298d8d6e52
@@ -204,6 +204,8 @@ module.exports = {
}, },
async createAuthorizationCode({ appId, userId, challenge }) { async createAuthorizationCode({ appId, userId, challenge }) {
if (!challenge) throw new Error('Please provide a valid challenge.')
const ac = { const ac = {
id: crs({ length: 42 }), id: crs({ length: 42 }),
appId, appId,