mirror of
https://github.com/PeterMaquiran/tvone-api.git
synced 2026-04-18 16:27:51 +00:00
return profile picture
This commit is contained in:
@@ -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,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user