Browse Source

fix(nocodb): add user email & display_name in req.user while using api xc-token auth

pull/8901/head
Ramesh Mane 5 months ago
parent
commit
e148abcb03
  1. 2
      packages/nocodb/src/strategies/authtoken.strategy/authtoken.strategy.ts
  2. 2
      packages/nocodb/src/strategies/jwt.strategy.ts

2
packages/nocodb/src/strategies/authtoken.strategy/authtoken.strategy.ts

@ -44,6 +44,8 @@ export class AuthTokenStrategy extends PassportStrategy(Strategy, 'authtoken') {
Object.assign(user, { Object.assign(user, {
id: dbUser.id, id: dbUser.id,
email: dbUser.email,
display_name: dbUser.display_name,
roles: extractRolesObj(dbUser.roles), roles: extractRolesObj(dbUser.roles),
base_roles: extractRolesObj(dbUser.base_roles), base_roles: extractRolesObj(dbUser.base_roles),
...(dbUser.workspace_roles ...(dbUser.workspace_roles

2
packages/nocodb/src/strategies/jwt.strategy.ts

@ -14,7 +14,7 @@ export class JwtStrategy extends PassportStrategy(Strategy) {
} }
async validate(req, jwtPayload) { async validate(req, jwtPayload) {
if (!jwtPayload?.email) { if (!jwtPayload?.email || jwtPayload?.is_api_token) {
return jwtPayload; return jwtPayload;
} }

Loading…
Cancel
Save