return profile picture

This commit is contained in:
2026-04-17 14:53:21 +01:00
parent 36b2eee680
commit c4eb6ef53a
8 changed files with 58 additions and 3 deletions
+24
View File
@@ -0,0 +1,24 @@
import { KeycloakAuthGuard } from '../auth/keycloak.guard';
import { ProfileService } from './profile.service';
import { Controller, Get, UseGuards, Request } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
@Controller('profile')
export class ProfileController {
constructor(private readonly profileService: ProfileService) {}
@UseGuards(AuthGuard('keycloak'))
@Get()
getProfile(@Request() req) {
// The 'user' object here is exactly what you returned from validate()
return {
email: req.user.email,
name: req.user.name,
picture: req.user.picture,
email_verified: req.user.email_verified,
roles: req.user.roles,
};
}
}