Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is passport-keycloak-bearer are compiable with NestJS? #30

Open
yougotnothing opened this issue Oct 26, 2024 · 0 comments
Open

is passport-keycloak-bearer are compiable with NestJS? #30

yougotnothing opened this issue Oct 26, 2024 · 0 comments

Comments

@yougotnothing
Copy link

i try to create custom Strategy, but have an error:

TypeError: Class extends value undefined is not a constructor or null
at PassportStrategy (/api/node_modules/@nestjs/passport/dist/passport/passport.strategy.js:6:33)
at Object.<anonymous> (/api/dist/main.js:3611:87)
     at __webpack_require__ (/api/dist/main.js:3663:33)
     at fn (/api/dist/main.js:3769:21)
     at Object.<anonymous> (/api/dist/main.js:1477:29)
     at __webpack_require__ (/api/dist/main.js:3663:33)
     at fn (/api/dist/main.js:3769:21)
     at Object.<anonymous> (/api/dist/main.js:372:16)
     at __webpack_require__ (/api/dist/main.js:3663:33)
     at fn (/api/dist/main.js:3769:21)

 Node.js v22.10.0

here is my PassportStrategy:

import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { PassportStrategy } from '@nestjs/passport';
import KeycloakBearerStrategy from 'passport-keycloak-bearer';

@Injectable()
export class KeycloakStrategy extends PassportStrategy(
  KeycloakBearerStrategy,
  'keycloak'
) {
  constructor() {
    super({
      realm: 'some-realm',
      url: 'http://localhost:8080/auth',
    });
  }

  validate(token: string, done: (error: Error | null, user?: any) => void) {
    done(null, { token });
  }
}

i'll be pleasure if you help me to solve this problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant