Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

213
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!