Get the auth token from cookie in the user_router

This is called through Cloud Task so .authorization is actually
Cloud Task's auth token.
This commit is contained in:
Jackson Harper 2023-01-06 10:29:33 +08:00
parent 8bac8c0fda
commit 3520428ff0

View file

@ -17,7 +17,7 @@ export function userRouter() {
router.post('/email', cors<express.Request>(corsConfig), async (req, res) => {
logger.info('email to-user router')
const token = req?.headers?.authorization
const token = req?.cookies?.auth || req?.headers?.authorization
const claims = await getClaimsByToken(token)
if (!claims) {
res.status(401).send('UNAUTHORIZED')