Populate service token user

This commit is contained in:
Maidul Islam
2023-01-15 21:40:19 -08:00
parent cf123d1887
commit 35f4d27ab0
2 changed files with 22 additions and 22 deletions
+1 -1
View File
@@ -148,7 +148,7 @@ const getAuthSTDPayload = async ({
serviceTokenData = await ServiceTokenData serviceTokenData = await ServiceTokenData
.findById(TOKEN_IDENTIFIER) .findById(TOKEN_IDENTIFIER)
.select('+encryptedKey +iv +tag'); .select('+encryptedKey +iv +tag').populate('user');
} catch (err) { } catch (err) {
throw UnauthorizedRequestError({ throw UnauthorizedRequestError({
@@ -17,10 +17,10 @@ const requireServiceTokenDataAuth = ({
const serviceTokenData = await ServiceTokenData const serviceTokenData = await ServiceTokenData
.findById(req[location].serviceTokenDataId) .findById(req[location].serviceTokenDataId)
.select('+encryptedKey +iv +tag'); .select('+encryptedKey +iv +tag').populate('user');
if (!serviceTokenData) { if (!serviceTokenData) {
return next(AccountNotFoundError({message: 'Failed to locate service token data'})); return next(AccountNotFoundError({ message: 'Failed to locate service token data' }));
} }
if (req.user) { if (req.user) {