a much needed check in order to prevent developer confusion :P
This commit is contained in:
parent
1ca055a526
commit
f8990ec7a6
@ -7,9 +7,14 @@ module.exports = async (oauth2, client, providedCode, redirectUri) => {
|
|||||||
|
|
||||||
let code = null
|
let code = null
|
||||||
|
|
||||||
|
if (!providedCode) {
|
||||||
|
throw new error.InvalidRequest('code is mandatory for authorization_code grant type')
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
code = await oauth2.model.code.fetchByCode(providedCode)
|
code = await oauth2.model.code.fetchByCode(providedCode)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
console.error(err)
|
||||||
throw new error.ServerError('Failed to call code.fetchByCode function')
|
throw new error.ServerError('Failed to call code.fetchByCode function')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user