Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

210
Visualizações
how to use nest-keycloack-connect to login a user

am working on a nest project and am trying to handle authentication using keycloack and i did connect my app to keycloack service

 KeycloakConnectModule.register({
  authServerUrl: 'http://localhost:8080/auth',
  realm: 'demo',
  clientId: 'nest-app',
  secret: 'c3e273bc-3286-44a6-bc21-82195718f0fb',
  // Secret key of the client taken from keycloak server
}),

and i did use the decorators and they did work fine

@Controller()
export class UserController {
  constructor(private readonly userService: UserService) {}
@Get('/public')
  @Unprotected()
  getpublic(): string {
    return `${this.userService.getHello()} from public`;
  }
@Get('/user')
  @Roles('user')
  getUser(): string {
    return `${this.userService.getHello()} from user`;
  }
@Get('/admin')
  @Roles('admin')
  getAdmin(): string {
    return `${this.userService.getHello()} from admin`;
  }
@Get('/all')
  @AllowAnyRole()
  getAll(): string {
    return `${this.userService.getHello()} from all`;
  }
}

now am wondering how to login and register a user from the nestjs server i did look and i did find that i can inject the

  constructor(
    @Inject(KEYCLOAK_INSTANCE) private keycloak: any,
  ) {}

now how am suppose to use that because theres no documentation on how to use the service and theres no autocomplete when i do

this.keycloack.login() // for example

can you help please ?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda