• Lead VietProDev's avatar
    fix(oidc): use default import and move findAccount into config · e44f463f
    Lead VietProDev authored
    Two related issues that prevented the OIDC provider from initializing in
    oidc-provider@9.8.4:
    
    1. require('oidc-provider') returns a module object with a default export
       (because the package is published as an ESM-compatible CJS module), not
       the class itself. The old code did `const OidcProvider = require(...)`
       and then `new OidcProvider(...)`, which produced "TypeError: OidcProvider
       is not a constructor". Switching to `const { default: OidcProvider } = ...`
       fixes this.
    
    2. In oidc-provider@9 the findAccount hook is no longer attached via
       `provider.defaults.findAccount = ...` (defaults object is undefined in
       9.x). It must be passed as a top-level config option, alongside adapter,
       cookies, claims, etc. The old code still attached it to defaults, which
       produced "TypeError: Cannot set properties of undefined (setting
       'findAccount')".
    
    Both fixes are required before OIDC provider can be constructed. After the
    fix, server logs show:
    
      [OK] OIDC provider initialized
      [OK] Listening on port 3001
    
    and `/.well-known/openid-configuration` returns the full OIDC discovery
    document with all standard endpoints.
    
    Note: this is on top of the previous commit 6eb4ba59 which already fixed the
    module-level OidcService.callback() crash. Both fixes are part of the same
    critical path to bring the server up.
    Co-authored-by: 's avatarCursor <cursoragent@cursor.com>
    e44f463f
Name
Last commit
Last update
.husky Loading commit data...
config Loading commit data...
docs Loading commit data...
infrastructure Loading commit data...
lib Loading commit data...
scripts Loading commit data...
sql Loading commit data...
src Loading commit data...
tests Loading commit data...
.dockerignore Loading commit data...
.env.example Loading commit data...
.eslintrc.js Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.prettierignore Loading commit data...
.prettierrc Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
Dockerfile Loading commit data...
PLANS.md Loading commit data...
PROGRESS.md Loading commit data...
README.md Loading commit data...
RUN.md Loading commit data...
docker-compose.ha.yml Loading commit data...
docker-compose.yml Loading commit data...
jest.config.ts Loading commit data...
nodemon.json Loading commit data...
package-lock.json Loading commit data...
package.json Loading commit data...
pnpm-lock.yaml Loading commit data...
test-login.json Loading commit data...
tsconfig.json Loading commit data...
tsconfig.test.json Loading commit data...