Skip to content

Commit

Permalink
Renvoie un code HTTP 401 EXPIRED_CREDENTIALS pour les OC
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregoire Ducharme committed Aug 30, 2024
1 parent c333c8c commit c9a5f84
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/middlewares.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ function verifyAgenceBioToken () {
request.organismeCertificateur = await checkOcToken(foundToken)
} catch (error) {
if (error.code) {
if (tokenExpirationErrorCodes.includes(error.code)) {
throw new ExpiredCredentialsApiError(error.code)
}
throw new UnauthorizedApiError("un jeton d'API Agence Bio valide est nécessaire pour accéder à ce contenu.", { cause: error })
} else {
throw new BadGatewayApiError('Le portail d\'authentification de l\'Agence Bio n\'a pas pu être contacté.', { cause: error })
Expand Down

0 comments on commit c9a5f84

Please sign in to comment.