Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
feat: improve error messages in validateFirebaseIdToken middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavopch committed Oct 4, 2020
1 parent e46ed10 commit decc087
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/functions/https/middlewares/validate-firebase-id-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export const validateFirebaseIdToken = (
const authorization = req.header('Authorization')
const [, idToken] = authorization?.split('Bearer ') ?? []
if (!idToken) {
console.log('Invalid authorization header:', authorization)
res.status(403).send('Invalid authorization header')
console.log("Missing the 'Authorization' header:", authorization)
res.status(403).send('Unauthorized')
return
}

Expand All @@ -35,7 +35,7 @@ export const validateFirebaseIdToken = (
req.userId = decodedIdToken.uid
next()
} catch (error) {
console.error('Error while verifying Firebase ID token:', error)
console.log("Couldn't verify the Firebase ID token:", error)
res.status(403).send('Unauthorized')
}
}
Expand Down

0 comments on commit decc087

Please sign in to comment.