• Vy Nguyễn Minh Khang's avatar
    fix(oidc): use default import and move findAccount into config · b16da9d9
    Vy Nguyễn Minh Khang 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>
    b16da9d9
Name
Last commit
Last update
..
audit Loading commit data...
config Loading commit data...
constants Loading commit data...
contracts Loading commit data...
controllers Loading commit data...
database Loading commit data...
interfaces Loading commit data...
jobs Loading commit data...
middlewares Loading commit data...
models Loading commit data...
oidc Loading commit data...
providers Loading commit data...
services Loading commit data...
templates Loading commit data...
tracing Loading commit data...
types Loading commit data...
utils Loading commit data...
workers Loading commit data...
index.ts Loading commit data...
root.ts Loading commit data...
server.ts Loading commit data...